Fix possible race condition.

This commit is contained in:
Themaister 2011-08-05 02:57:30 +02:00
parent 4759e3411f
commit 014c3c90e0

View File

@ -192,8 +192,6 @@ static void dsound_free(void *data)
dsound_t *ds = data; dsound_t *ds = data;
if (ds) if (ds)
{ {
DeleteCriticalSection(&ds->crit);
if (ds->thread) if (ds->thread)
{ {
ds->thread_alive = false; ds->thread_alive = false;
@ -201,6 +199,8 @@ static void dsound_free(void *data)
CloseHandle(ds->thread); CloseHandle(ds->thread);
} }
DeleteCriticalSection(&ds->crit);
if (ds->dsb) if (ds->dsb)
{ {
IDirectSoundBuffer_Stop(ds->dsb); IDirectSoundBuffer_Stop(ds->dsb);