[Bf-blender-cvs] [14b9c79] master: Fix for another deadlock with py-drivers: BlendData.scene.remove()
Campbell Barton
noreply at git.blender.org
Mon Feb 17 09:31:03 CET 2014
Commit: 14b9c79483ec5f282dc04a5efe5945653dc0a678
Author: Campbell Barton
Date: Mon Feb 17 19:29:37 2014 +1100
https://developer.blender.org/rB14b9c79483ec5f282dc04a5efe5945653dc0a678
Fix for another deadlock with py-drivers: BlendData.scene.remove()
===================================================================
M source/blender/makesrna/intern/rna_main_api.c
M source/blender/makesrna/intern/rna_screen.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 5d0d7bf..e008841 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -104,6 +104,10 @@
#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);
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 5902f30..adea1f6 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -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);
More information about the Bf-blender-cvs
mailing list