[Bf-blender-cvs] [a4c907af776] master: Fix T65806: Can't Access bpy.context inside Application Timer

Sergey Sharybin noreply at git.blender.org
Thu Jun 20 10:37:02 CEST 2019


Commit: a4c907af7760a980c09e46feed92bd93a0906ba9
Author: Sergey Sharybin
Date:   Thu Jun 20 10:28:52 2019 +0200
Branches: master
https://developer.blender.org/rBa4c907af7760a980c09e46feed92bd93a0906ba9

Fix T65806: Can't Access bpy.context inside Application Timer

Sound synchronization was messing a bit with the context, for, actually,
no reason.

Use more direct queries rather than relying on a context there.

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

M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index f20bc6b11fe..a95ccd65dff 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3230,14 +3230,11 @@ void wm_event_do_handlers(bContext *C)
     }
     else {
       Scene *scene = WM_window_get_active_scene(win);
+      ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+      Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false);
+      Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL;
 
-      CTX_wm_window_set(C, win);
-      CTX_data_scene_set(C, scene);
-
-      Depsgraph *depsgraph = CTX_data_depsgraph(C);
-      Scene *scene_eval = DEG_get_evaluated_scene_if_exists(depsgraph);
-
-      if (scene_eval) {
+      if (scene_eval != NULL) {
         const int is_playing_sound = BKE_sound_scene_playing(scene_eval);
 
         if (is_playing_sound != -1) {
@@ -3263,10 +3260,6 @@ void wm_event_do_handlers(bContext *C)
           }
         }
       }
-
-      CTX_data_scene_set(C, NULL);
-      CTX_wm_screen_set(C, NULL);
-      CTX_wm_window_set(C, NULL);
     }
 
     while ((event = win->queue.first)) {



More information about the Bf-blender-cvs mailing list