diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-01 12:31:53 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-01 12:31:53 +0300 |
commit | c64b72998cfaab0512de38843219d074e876a0a8 (patch) | |
tree | 236a0e58acb903665f2cfbf2af940a57a3b35a8a | |
parent | 89946834a1708db91645aac4fb950b7588035d6d (diff) |
Fix T66283: Crash on redo/undo during playback
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index ef99d39f990..5fc7979a631 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4200,6 +4200,7 @@ static int match_region_with_redraws(int spacetype, static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { bScreen *screen = CTX_wm_screen(C); + wmWindow *win = CTX_wm_window(C); #ifdef PROFILE_AUDIO_SYNCH static int old_frame = 0; @@ -4209,8 +4210,9 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv if (screen->animtimer && screen->animtimer == event->customdata) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); - Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + 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; wmTimer *wt = screen->animtimer; ScreenAnimData *sad = wt->customdata; wmWindowManager *wm = CTX_wm_manager(C); @@ -4230,7 +4232,11 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv sync = (scene->flag & SCE_FRAME_DROP); } - if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) { + if (scene_eval == NULL) { + /* Happens when undo/redo system is used during playback, nothing meaningful we can do here. + */ + } + else if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) { /* Ignore seek here, the audio will be updated to the scene frame after jump during next * dependency graph update. */ } @@ -4335,7 +4341,9 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv } /* since we follow drawflags, we can't send notifier but tag regions ourselves */ - ED_update_for_newframe(bmain, depsgraph); + if (depsgraph != NULL) { + ED_update_for_newframe(bmain, depsgraph); + } for (window = wm->windows.first; window; window = window->next) { const bScreen *win_screen = WM_window_get_active_screen(window); |