Skip to content

Commit

Permalink
Fixed segfault during shutdown if the engine-internal sdl_mixer audio…
Browse files Browse the repository at this point in the history
… driver is used.
  • Loading branch information
danij committed Dec 29, 2008
1 parent 4a6c84f commit c5f848a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions doomsday/engine/unix/src/sys_audiod_loader.c
Expand Up @@ -37,6 +37,7 @@

#include "de_console.h"

#include "s_main.h"
#include "sys_audiod.h"
#include "sys_audiod_sfx.h"
#include "sys_audiod_mus.h"
Expand Down Expand Up @@ -75,11 +76,14 @@ static void* Imp(const char* fn)

void Sys_ShutdownAudioDriver(void)
{
audiodriver_t* d = &audiodExternal;
if(audioDriver->Shutdown)
audioDriver->Shutdown();

d->Shutdown();
lt_dlclose(handle);
handle = NULL;
if(audioDriver == &audiodExternal)
{
lt_dlclose(handle);
handle = NULL;
}
}

static audiodriver_t* importExternal(void)
Expand Down
12 changes: 8 additions & 4 deletions doomsday/engine/win32/src/sys_audiod_loader.c
Expand Up @@ -35,6 +35,7 @@

#include "de_console.h"

#include "s_main.h"
#include "sys_audiod.h"
#include "sys_audiod_sfx.h"
#include "sys_audiod_mus.h"
Expand Down Expand Up @@ -73,11 +74,14 @@ static void* Imp(const char* fn)

void Sys_ShutdownAudioDriver(void)
{
audiodriver_t* d = &audiodExternal;
if(audioDriver->Shutdown)
audioDriver->Shutdown();

d->Shutdown();
FreeLibrary(hInstExt);
hInstExt = NULL;
if(audioDriver == &audiodExternal)
{
FreeLibrary(hInstExt);
hInstExt = NULL;
}
}

static audiodriver_t* importExternal(void)
Expand Down

0 comments on commit c5f848a

Please sign in to comment.