Fix T66283: Crash on redo/undo during playback

This commit is contained in:
Sergey Sharybin 2019-07-01 11:31:53 +02:00
parent 89946834a1
commit c64b72998c

@ -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) static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{ {
bScreen *screen = CTX_wm_screen(C); bScreen *screen = CTX_wm_screen(C);
wmWindow *win = CTX_wm_window(C);
#ifdef PROFILE_AUDIO_SYNCH #ifdef PROFILE_AUDIO_SYNCH
static int old_frame = 0; 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) { if (screen->animtimer && screen->animtimer == event->customdata) {
Main *bmain = CTX_data_main(C); Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C); ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); 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; wmTimer *wt = screen->animtimer;
ScreenAnimData *sad = wt->customdata; ScreenAnimData *sad = wt->customdata;
wmWindowManager *wm = CTX_wm_manager(C); 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); 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 /* Ignore seek here, the audio will be updated to the scene frame after jump during next
* dependency graph update. */ * 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 */ /* 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) { for (window = wm->windows.first; window; window = window->next) {
const bScreen *win_screen = WM_window_get_active_screen(window); const bScreen *win_screen = WM_window_get_active_screen(window);