[Bf-blender-cvs] [1562fd9] master: Fix T38664: Blender hang when change scene from script

Sergey Sharybin noreply at git.blender.org
Mon Feb 17 07:34:39 CET 2014


Commit: 1562fd99f173898b3698972c90cdcb96c851dbbf
Author: Sergey Sharybin
Date:   Mon Feb 17 12:33:00 2014 +0600
https://developer.blender.org/rB1562fd99f173898b3698972c90cdcb96c851dbbf

Fix T38664: Blender hang when change scene from script

Deadlock between python script evaluation thread and
drivers evaluation caused by scene update invoked from
ED_screen_set_scene().

Pretty much the same as setting scene current frame
with the same solution BPy_{BEGIN,END}_ALLOW_THREADS.

===================================================================

M	source/blender/makesrna/intern/rna_screen.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 5f65260..5902f30 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -60,6 +60,10 @@ EnumPropertyItem region_type_items[] = {
 
 #include "UI_view2d.h"
 
+#ifdef WITH_PYTHON
+#  include "BPY_extern.h"
+#endif
+
 static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value)
 {
 	bScreen *sc = (bScreen *)ptr->data;
@@ -76,7 +80,16 @@ 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;
+#endif
+
 		ED_screen_set_scene(C, sc, sc->newscene);
+
+#ifdef WITH_PYTHON
+	BPy_END_ALLOW_THREADS;
+#endif
+
 		WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, sc->newscene);
 
 		if (G.debug & G_DEBUG)




More information about the Bf-blender-cvs mailing list