diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-16 19:58:45 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-16 19:58:45 +0300 |
commit | f17dcf58c86274661a10cf4f95939deb63a02fa7 (patch) | |
tree | 94fc52b7e0d41d6cb806eaf5e0b0e604c20722c1 /source/blender/blenlib/intern/threads.c | |
parent | 735b444d74d41bf2cec1ab81e781283e79d9c3d6 (diff) |
Fixes for thread related render / compositing crashes:
* Viewer node could free image while it is being redrawn, viewer image
buffers now need acquire/release to be accessed as was already the
case for render results.
* The Composite node could free the image buffers outside of a lock,
also causing simultaneous redraw to crash.
* Especially on Windows, re-rendering could crash when drawing an image
that was freed. When RE_RenderInProgress was true it would access the
image buffer and simply return it while it could still contain a pointer
to a render result buffer that was already freed. I don't understand
why this case was there in the first place, so I've removed it.
Possibly fixes bugs #20174, #21418, #21391, #21394.
Diffstat (limited to 'source/blender/blenlib/intern/threads.c')
-rw-r--r-- | source/blender/blenlib/intern/threads.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 02d6ab0b7b5..be016456fc4 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -109,6 +109,7 @@ A sample loop can look like this (pseudo c); static pthread_mutex_t _malloc_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _image_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _preview_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t _viewer_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER; static int thread_levels= 0; /* threads can be invoked inside threads */ @@ -327,6 +328,8 @@ void BLI_lock_thread(int type) pthread_mutex_lock(&_image_lock); else if (type==LOCK_PREVIEW) pthread_mutex_lock(&_preview_lock); + else if (type==LOCK_VIEWER) + pthread_mutex_lock(&_viewer_lock); else if (type==LOCK_CUSTOM1) pthread_mutex_lock(&_custom1_lock); } @@ -337,6 +340,8 @@ void BLI_unlock_thread(int type) pthread_mutex_unlock(&_image_lock); else if (type==LOCK_PREVIEW) pthread_mutex_unlock(&_preview_lock); + else if (type==LOCK_VIEWER) + pthread_mutex_unlock(&_viewer_lock); else if(type==LOCK_CUSTOM1) pthread_mutex_unlock(&_custom1_lock); } |