From 62acfb3348d800a97484be4833c6d4ac7437f2ec Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 13 Apr 2018 21:30:26 -0400 Subject: [PATCH] sdl_snd.c should just initialize SDL audio without checking SDL_WasInit(). In SDL2, the initialized subsystems are referenced counted, so it's safe to initialize them twice, and it makes the SDL_QuitSubSystem during our shutdown correctly decrement the count. Before (as a probably-harmless bug), it would not increment the refcount if the subsystem was already initialized, causing problems when it decremented it later. --- code/sdl/sdl_snd.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/code/sdl/sdl_snd.c b/code/sdl/sdl_snd.c index 2be64e1d..0a6e78db 100644 --- a/code/sdl/sdl_snd.c +++ b/code/sdl/sdl_snd.c @@ -156,13 +156,10 @@ qboolean SNDDMA_Init(void) Com_Printf( "SDL_Init( SDL_INIT_AUDIO )... " ); - if (!SDL_WasInit(SDL_INIT_AUDIO)) + if (SDL_Init(SDL_INIT_AUDIO) != 0) { - if (SDL_Init(SDL_INIT_AUDIO) != 0) - { - Com_Printf( "FAILED (%s)\n", SDL_GetError( ) ); - return qfalse; - } + Com_Printf( "FAILED (%s)\n", SDL_GetError( ) ); + return qfalse; } Com_Printf( "OK\n" );