Fix for another deadlock with py-drivers: BlendData.scene.remove()
authorCampbell Barton <ideasman42@gmail.com>
Mon, 17 Feb 2014 08:29:37 +0000 (19:29 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 17 Feb 2014 08:30:31 +0000 (19:30 +1100)
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_screen.c

index 5d0d7bf20dfa7a99373cab8549a199d24c9eb475..e0088416883cc822b561aa97997d71a5788f157b 100644 (file)
 
 #include "BLF_translation.h"
 
+#ifdef WITH_PYTHON
+#  include "BPY_extern.h"
+#endif
+
 static Camera *rna_Main_cameras_new(Main *bmain, const char *name)
 {
        ID *id = BKE_camera_add(bmain, name);
@@ -138,7 +142,17 @@ static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports
        {
                bScreen *sc = CTX_wm_screen(C);
                if (sc->scene == scene) {
+
+#ifdef WITH_PYTHON
+                       BPy_BEGIN_ALLOW_THREADS;
+#endif
+
                        ED_screen_set_scene(C, sc, scene_new);
+
+#ifdef WITH_PYTHON
+                       BPy_END_ALLOW_THREADS;
+#endif
+
                }
 
                BKE_scene_unlink(bmain, scene, scene_new);
index 5902f3095fc54a950be42b76c10797fbbfd63515..adea1f641a982cdb6cf91fe9e5ebbacf514a6074 100644 (file)
@@ -81,13 +81,13 @@ static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr)
        /* exception: must use context so notifier gets to the right window  */
        if (sc->newscene) {
 #ifdef WITH_PYTHON
-       BPy_BEGIN_ALLOW_THREADS;
+               BPy_BEGIN_ALLOW_THREADS;
 #endif
 
                ED_screen_set_scene(C, sc, sc->newscene);
 
 #ifdef WITH_PYTHON
-       BPy_END_ALLOW_THREADS;
+               BPy_END_ALLOW_THREADS;
 #endif
 
                WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, sc->newscene);