diff options
-rw-r--r-- | source/blender/render/intern/pipeline.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c index bf42adbab87..0f9e1c944f5 100644 --- a/source/blender/render/intern/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -1870,6 +1870,21 @@ static void render_pipeline_free(Render *re) } /* Destroy the opengl context in the correct thread. */ RE_gl_context_destroy(re); + + /* In the case the engine did not mark tiles as finished (un-highlight, which could happen in the + * case of cancelled render) ensure the storage is empty. */ + if (re->highlighted_tiles != NULL) { + BLI_mutex_lock(&re->highlighted_tiles_mutex); + + /* Rendering is supposed to be finished here, so no new tiles are expected to be written. + * Only make it so possible read-only access to the highlighted tiles is thread-safe. */ + BLI_assert(re->highlighted_tiles); + + BLI_gset_free(re->highlighted_tiles, MEM_freeN); + re->highlighted_tiles = NULL; + + BLI_mutex_unlock(&re->highlighted_tiles_mutex); + } } /* general Blender frame render call */ |