From d3b42fc167e548655ade53ecaa5c3a11b8ef6a81 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 10 Jul 2019 11:57:13 +0200 Subject: Fix T66626: Crash when using JACK audio device Restore some context overrides which were originally happening in 2.79. Made it a bit more paranoid, by storing old values and restoring them afterwards, so the context is not being changed at the end of the function. --- source/blender/windowmanager/intern/wm_event_system.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 6ae682e678a..4bda5167f60 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -3242,11 +3242,23 @@ void wm_event_do_handlers(bContext *C) if (((is_playing_sound == 1) && (is_playing_screen == 0)) || ((is_playing_sound == 0) && (is_playing_screen == 1))) { + wmWindow *context_old_win = CTX_wm_window(C); + bScreen *context_screen_win = CTX_wm_screen(C); + Scene *context_scene_win = CTX_data_scene(C); + + CTX_wm_window_set(C, win); + CTX_wm_screen_set(C, screen); + CTX_data_scene_set(C, scene); + ED_screen_animation_play(C, -1, 1); + + CTX_data_scene_set(C, context_scene_win); + CTX_wm_screen_set(C, context_screen_win); + CTX_wm_window_set(C, context_old_win); } if (is_playing_sound == 0) { - const float time = BKE_sound_sync_scene(scene); + const float time = BKE_sound_sync_scene(scene_eval); if (isfinite(time)) { int ncfra = time * (float)FPS + 0.5f; if (ncfra != scene->r.cfra) { -- cgit v1.2.3