diff options
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r-- | src/frontend/qt_sdl/AudioInOut.cpp | 9 | ||||
-rw-r--r-- | src/frontend/qt_sdl/LocalMP.cpp | 21 |
2 files changed, 20 insertions, 10 deletions
diff --git a/src/frontend/qt_sdl/AudioInOut.cpp b/src/frontend/qt_sdl/AudioInOut.cpp index d44e92d..48e8a86 100644 --- a/src/frontend/qt_sdl/AudioInOut.cpp +++ b/src/frontend/qt_sdl/AudioInOut.cpp @@ -334,12 +334,17 @@ void Init() void DeInit() { if (audioDevice) SDL_CloseAudioDevice(audioDevice); + audioDevice = 0; MicClose(); - SDL_DestroyCond(audioSync); - SDL_DestroyMutex(audioSyncLock); + if (audioSync) SDL_DestroyCond(audioSync); + audioSync = nullptr; + + if (audioSyncLock) SDL_DestroyMutex(audioSyncLock); + audioSyncLock = nullptr; if (micWavBuffer) delete[] micWavBuffer; + micWavBuffer = nullptr; } void AudioSync() diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp index 31801b7..870ea8b 100644 --- a/src/frontend/qt_sdl/LocalMP.cpp +++ b/src/frontend/qt_sdl/LocalMP.cpp @@ -297,16 +297,21 @@ bool Init() void DeInit() { - MPQueue->lock(); - MPQueueHeader* header = (MPQueueHeader*)MPQueue->data(); - header->ConnectedBitmask &= ~(1 << InstanceID); - header->InstanceBitmask &= ~(1 << InstanceID); - header->NumInstances--; - MPQueue->unlock(); + if (MPQueue) + { + MPQueue->lock(); + MPQueueHeader* header = (MPQueueHeader*)MPQueue->data(); + header->ConnectedBitmask &= ~(1 << InstanceID); + header->InstanceBitmask &= ~(1 << InstanceID); + header->NumInstances--; + MPQueue->unlock(); - SemPoolDeinit(); + SemPoolDeinit(); + + MPQueue->detach(); + } - MPQueue->detach(); + MPQueue = nullptr; delete MPQueue; } |