changeset 1580:ea7d5ced2415

Fix deadlock when changing settings before loading first ROM
author Michael Pavone <pavone@retrodev.com>
date Tue, 01 May 2018 23:55:48 -0700
parents f66290afae65
children 7121daaa48c2
files render_sdl.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/render_sdl.c	Tue May 01 20:19:31 2018 -0700
+++ b/render_sdl.c	Tue May 01 23:55:48 2018 -0700
@@ -1158,8 +1158,13 @@
 	}
 #endif
 
-	SDL_CloseAudio();
+	uint8_t was_paused = SDL_GetAudioStatus() == SDL_AUDIO_PAUSED;
+	render_close_audio();
+	quitting = 0;
 	init_audio();
+	if (!was_paused) {
+		SDL_PauseAudio(0);
+	}
 	
 	double lowpass_cutoff = get_lowpass_cutoff(config);
 	double rc = (1.0 / lowpass_cutoff) / (2.0 * M_PI);