diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-13 17:47:13 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-13 17:47:13 +0400 |
commit | 807ad1f0e0de49711d58ade2b660e74ec5452b2b (patch) | |
tree | 06989f02b2a73b64cb89e28d79a294ac357c4206 /source/blender/compositor/operations/COM_CompositorOperation.cpp | |
parent | a5e6d73d412146cf9cdd077aec0b71cb615dd361 (diff) |
Fix #32087: Crash while changing values in comp editor (bt and blender included)
Issue was caused by threading conflict between compositor output node which
is freeing buffers used by render result image and image draw code which
could use buffers at the same time as compositor frees this buffers.
Solved by adding adding lock around viewer image invalidation and image
drawing.
Use renamed LOCK_PREVIEW mutex for this, which si not called LOCK_DRAW_IMAGE.
With new compositor locking for preview is not needed so it could be removed.
Added the same lock around viewer operation which also frees buffers used
by viewer image. It's actually quite difficult to check whether this is
indeed needed. This code seems to be using acquire/release technique, but
somehow acquiring ImBuf before invalidating it in compositor operation
doesn't resolve the issue, so probably it's not actually locking acquire
and things should be checked deeper.
Diffstat (limited to 'source/blender/compositor/operations/COM_CompositorOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_CompositorOperation.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 445b0634ced..43aad4f19d9 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -27,6 +27,7 @@ #include "BKE_image.h" extern "C" { + #include "BLI_threads.h" #include "RE_pipeline.h" #include "RE_shader_ext.h" #include "RE_render_ext.h" @@ -63,6 +64,7 @@ void CompositorOperation::deinitExecution() const RenderData *rd = this->m_rd; Render *re = RE_GetRender_FromData(rd); RenderResult *rr = RE_AcquireResultWrite(re); + if (rr) { if (rr->rectf != NULL) { MEM_freeN(rr->rectf); @@ -75,7 +77,9 @@ void CompositorOperation::deinitExecution() } } + BLI_lock_thread(LOCK_DRAW_IMAGE); BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE); + BLI_unlock_thread(LOCK_DRAW_IMAGE); if (re) { RE_ReleaseResult(re); |