Fix #32087: Crash while changing values in comp editor (bt and blender included)
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 13 Jul 2012 13:47:13 +0000 (13:47 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 13 Jul 2012 13:47:13 +0000 (13:47 +0000)
commit807ad1f0e0de49711d58ade2b660e74ec5452b2b
tree06989f02b2a73b64cb89e28d79a294ac357c4206
parenta5e6d73d412146cf9cdd077aec0b71cb615dd361
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.
source/blender/blenlib/BLI_threads.h
source/blender/blenlib/intern/threads.c
source/blender/compositor/operations/COM_CompositorOperation.cpp
source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_node/node_draw.c
source/blender/nodes/composite/node_composite_util.c