diff options
author | Joakim Plate <elupus@ecce.se> | 2013-04-28 13:08:00 +0200 |
---|---|---|
committer | Joakim Plate <elupus@ecce.se> | 2013-04-28 13:51:58 +0200 |
commit | 724d42236b82b165c3aa881616ae73a3141e164e (patch) | |
tree | d60b7cf0ff3cc17a31aac672cac0790fe2984636 | |
parent | 94599d93ec3a551623cbe4e8eda3e529d68165d6 (diff) |
CoreAE: fix crash on app exit due to race condition
We must unregister callback before shuting down AE, and also re-check
that we are not shutdown in the callback after taking lock
-rw-r--r-- | xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp index ab9e90c3de..6435c87a27 100644 --- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp @@ -105,8 +105,8 @@ CCoreAudioAE::CCoreAudioAE() : CCoreAudioAE::~CCoreAudioAE() { - Shutdown(); RegisterDeviceChangedCB(false, this); + Shutdown(); } void CCoreAudioAE::Shutdown() @@ -150,6 +150,10 @@ void CCoreAudioAE::AudioDevicesChanged() // again (yeah that really is the case - duh) Sleep(500); CSingleLock engineLock(m_engineLock); + + // re-check initialized since it can have changed when we waited and grabbed the lock + if (!m_Initialized) + return; OpenCoreAudio(m_lastSampleRate, COREAUDIO_IS_RAW(m_lastStreamFormat), m_lastStreamFormat); } |