[Bf-blender-cvs] [2e582f8ab53] master: Sound: Fix access wrong dependency graph

Sergey Sharybin noreply at git.blender.org
Mon May 6 11:32:55 CEST 2019


Commit: 2e582f8ab53c7bcd9fabce8ec2b1d812ec28f58d
Author: Sergey Sharybin
Date:   Mon May 6 11:29:25 2019 +0200
Branches: master
https://developer.blender.org/rB2e582f8ab53c7bcd9fabce8ec2b1d812ec28f58d

Sound: Fix access wrong dependency graph

Due to some fields in the context being NULL access was happening
to the default view layer, not the active one.

Simply re-arranged context initialization, so it happens before
accessing dependnecy graph.

Fixes T64183: Crash in BKE_sound_scene_playing due to Scene NULL
Fixes T64192: Crash opening a file with a non-default View Layer active

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

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 a13b28b7853..6745af25dcd 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3091,8 +3091,12 @@ void wm_event_do_handlers(bContext *C)
       wm_event_free_all(win);
     }
     else {
-      Depsgraph *depsgraph = CTX_data_depsgraph(C);
       Scene *scene = WM_window_get_active_scene(win);
+
+      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(depsgraph);
 
       if (scene) {
@@ -3100,8 +3104,6 @@ void wm_event_do_handlers(bContext *C)
 
         if (is_playing_sound != -1) {
           bool is_playing_screen;
-          CTX_wm_window_set(C, win);
-          CTX_data_scene_set(C, scene);
 
           is_playing_screen = (ED_screen_animation_playing(wm) != NULL);
 
@@ -3121,12 +3123,12 @@ 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);
         }
       }
+
+      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