diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-06 12:29:25 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-06 12:32:01 +0300 |
commit | 2e582f8ab53c7bcd9fabce8ec2b1d812ec28f58d (patch) | |
tree | 57077c5dab2ef324eafc5364932772f638465e26 /source/blender | |
parent | 22e9365e8b9e2fe6d471950e6046fa6a92a67e71 (diff) |
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
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 16 |
1 files changed, 9 insertions, 7 deletions
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)) { |