diff render_sdl.c @ 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 ade5b8148caa
children 430dd12e4010
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);