Move call to drw_state_ensure_not_reused() inside the region locked by DST.gl_context_mutex.

Currently with a debug build there is a race condition where the mutex is released before the DST structure is reset to 0xFF, meaning when multiple threads are using the DRWManager it can get cleared when the main thread is using it, causing crashes.

Reviewers: fclem, brecht

Reviewed By: fclem

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3476
This commit is contained in:
2018-06-14 12:01:18 +02:00
parent 17b029d80e
commit d64cd6f7ee
4 changed files with 8 additions and 8 deletions

View File

@@ -1548,6 +1548,11 @@ void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph)
GPU_viewport_free(DST.viewport);
GPU_framebuffer_restore();
#ifdef DEBUG
/* Avoid accidental reuse. */
drw_state_ensure_not_reused(&DST);
#endif
/* Changing Context */
if (re_gl_context != NULL) {
DRW_shape_cache_reset(); /* XXX fix that too. */
@@ -1560,11 +1565,6 @@ void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph)
else {
DRW_opengl_context_disable();
}
#ifdef DEBUG
/* Avoid accidental reuse. */
drw_state_ensure_not_reused(&DST);
#endif
}
void DRW_render_object_iter(