DRW: Fix multithreading conflict with material previews.

This commit is contained in:
Clément Foucault 2018-02-27 15:50:34 +01:00
parent ec0ecbe795
commit 158a1de4fb
1 changed files with 6 additions and 0 deletions

View File

@ -3376,6 +3376,10 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
return;
}
/* XXX Really nasty locking. But else this could
* be executed by the material previews thread
* while rendering a viewport. */
BLI_mutex_lock(&g_ogl_context_mutex);
/* Reset before using it. */
memset(&DST, 0x0, sizeof(DST));
@ -3400,6 +3404,8 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
DST.viewport = NULL;
drw_engines_disable();
BLI_mutex_unlock(&g_ogl_context_mutex);
}
/** \} */