[Bf-blender-cvs] [bda6eb1e27b] master: Fix T71383: Error setting the windows workspaces from Python

Campbell Barton noreply at git.blender.org
Fri Sep 18 10:03:29 CEST 2020


Commit: bda6eb1e27b8e2902b1336101f44a71a7be235c7
Author: Campbell Barton
Date:   Fri Sep 18 17:57:21 2020 +1000
Branches: master
https://developer.blender.org/rBbda6eb1e27b8e2902b1336101f44a71a7be235c7

Fix T71383: Error setting the windows workspaces from Python

Assigning window variables relied on notifiers that always used the
active window, no matter the window being assigned.

Pass the current window to the notifier.

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

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

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

diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 3e8c469fc31..8c7bcd9b442 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -737,7 +737,8 @@ static void rna_Window_scene_update(bContext *C, PointerRNA *ptr)
     BPy_END_ALLOW_THREADS;
 #  endif
 
-    WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, win->new_scene);
+    wmWindowManager *wm = CTX_wm_manager(C);
+    WM_event_add_notifier_ex(wm, win, NC_SCENE | ND_SCENEBROWSE, win->new_scene);
 
     if (G.debug & G_DEBUG) {
       printf("scene set %p\n", win->new_scene);
@@ -780,7 +781,8 @@ static void rna_Window_workspace_update(bContext *C, PointerRNA *ptr)
   /* exception: can't set screens inside of area/region handlers,
    * and must use context so notifier gets to the right window */
   if (new_workspace) {
-    WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
+    wmWindowManager *wm = CTX_wm_manager(C);
+    WM_event_add_notifier_ex(wm, win, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
     win->workspace_hook->temp_workspace_store = NULL;
   }
 }
@@ -828,7 +830,8 @@ static void rna_workspace_screen_update(bContext *C, PointerRNA *ptr)
   /* exception: can't set screens inside of area/region handlers,
    * and must use context so notifier gets to the right window */
   if (layout_new) {
-    WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
+    wmWindowManager *wm = CTX_wm_manager(C);
+    WM_event_add_notifier_ex(wm, win, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
     win->workspace_hook->temp_layout_store = NULL;
   }
 }



More information about the Bf-blender-cvs mailing list