Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-01-15 11:56:38 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-01-15 11:56:38 +0400
commit440ef7356aa45f908b755489423d06209514f875 (patch)
treec578a2a3ab999041491b55dc02364751f26896dd /source
parentf9133c5ccc31c1de836e6129662aed510441d424 (diff)
Two threading issues:
- Drawing masks in image editor requires LOCK_DRAW_IMAGE around ED_space_image_get* functions since they'll acquire image buffer. Lock is needed because viewers will be modified directly in compositor (see commend in draw_image_main) - Seems that was wrong order of invalidating render result and viewer image invalidation happened in Composite node, which could easily lead to thread lock.
Diffstat (limited to 'source')
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp8
-rw-r--r--source/blender/editors/space_image/space_image.c18
2 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index 141d071dddc..e6a49082a71 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -91,14 +91,14 @@ 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);
re = NULL;
}
+
+ 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);
}
else {
if (this->m_outputBuffer) {
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 9492e29734d..39d256321bf 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_threads.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
@@ -692,10 +693,25 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
}
if (mask) {
- int width, height;
+ Image *image = ED_space_image(sima);
+ int width, height, show_viewer;
float aspx, aspy;
+
+ show_viewer = (image && image->source == IMA_SRC_VIEWER);
+
+ if (show_viewer) {
+ /* ED_space_image_get will acquire image buffer which requires
+ * lock here by the same reason why lock is needed in draw_image_main
+ */
+ BLI_lock_thread(LOCK_DRAW_IMAGE);
+ }
+
ED_space_image_get_size(sima, &width, &height);
ED_space_image_get_aspect(sima, &aspx, &aspy);
+
+ if (show_viewer)
+ BLI_unlock_thread(LOCK_DRAW_IMAGE);
+
ED_mask_draw_region(mask, ar,
sima->mask_info.draw_flag, sima->mask_info.draw_type,
width, height,