2.5
authorTon Roosendaal <ton@blender.org>
Sun, 7 Jun 2009 12:12:55 +0000 (12:12 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 7 Jun 2009 12:12:55 +0000 (12:12 +0000)
Quick test commit to check on crashing previews; ignore warning about
implicit declaration...  here in OSX i can't get this crash!

source/blender/blenlib/intern/threads.c
source/blender/editors/preview/previewrender.c

index 884724270ae07d293e21af388cb144bae8c8aca7..2812f17d58fd4a0697b1237d905de1d7c7fd701c 100644 (file)
@@ -112,12 +112,12 @@ typedef struct ThreadSlot {
        int avail;
 } ThreadSlot;
 
-static void BLI_lock_malloc_thread(void)
+void BLI_lock_malloc_thread(void)
 {
        pthread_mutex_lock(&_malloc_lock);
 }
 
-static void BLI_unlock_malloc_thread(void)
+void BLI_unlock_malloc_thread(void)
 {
        pthread_mutex_unlock(&_malloc_lock);
 }
index a17c488f1c974eb39d83f445ab419e4d0ba182e4..096282a0f58d4111ef01afa3baa25672025f6cfa 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "BLI_arithb.h"
 #include "BLI_blenlib.h"
+#include "BLI_threads.h"
 
 #include "DNA_texture_types.h"
 #include "DNA_world_types.h"
@@ -634,6 +635,7 @@ void ED_preview_draw(const bContext *C, void *idp, rcti *rect)
        char name[32];
        
        sprintf(name, "Preview %p", sa);
+       BLI_lock_malloc_thread();
        RE_GetResultImage(RE_GetRender(name), &rres);
 
        if(rres.rectf) {
@@ -648,7 +650,8 @@ void ED_preview_draw(const bContext *C, void *idp, rcti *rect)
                        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                }
        }
-       
+       BLI_unlock_malloc_thread();
+
        /* check for spacetype... */
        if(sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
                sbuts->preview= 0;