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.
This commit is contained in:
2019-07-10 11:57:13 +02:00
parent f4b963dbdd
commit d3b42fc167

View File

@@ -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) {