Skip to content
This repository
Browse code

[CA/AE] - make the devicelist change callback more robust - should fi…

…x crashes during shutdown on some system constellations (where removing the callback seems to also triggers the callback at the same time)
  • Loading branch information...
commit f6a002b0971138a785d03a934ad623b690a8becc 1 parent 5370a93
Memphiz authored March 18, 2013
12  xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp
@@ -51,8 +51,11 @@ OSStatus deviceChangedCB( AudioObjectID                       inObjectID,
51 51
                           void*                               inClientData)
52 52
 {
53 53
   CCoreAudioAE *pEngine = (CCoreAudioAE *)inClientData;
54  
-  pEngine->AudioDevicesChanged();
55  
-  CLog::Log(LOGDEBUG, "CCoreAudioAE - audiodevicelist changed!");
  54
+  if (pEngine->GetHAL())
  55
+  {
  56
+    pEngine->AudioDevicesChanged();
  57
+    CLog::Log(LOGDEBUG, "CCoreAudioAE - audiodevicelist changed!");
  58
+  }
56 59
   return noErr;
57 60
 }
58 61
 
@@ -102,8 +105,8 @@ CCoreAudioAE::CCoreAudioAE() :
102 105
 
103 106
 CCoreAudioAE::~CCoreAudioAE()
104 107
 {
105  
-  RegisterDeviceChangedCB(false, this);
106 108
   Shutdown();
  109
+  RegisterDeviceChangedCB(false, this);
107 110
 }
108 111
 
109 112
 void CCoreAudioAE::Shutdown()
@@ -138,6 +141,9 @@ void CCoreAudioAE::Shutdown()
138 141
 
139 142
 void CCoreAudioAE::AudioDevicesChanged()
140 143
 {
  144
+  if (!m_Initialized)
  145
+    return;
  146
+
141 147
   // give CA a bit time to realise that maybe the 
142 148
   // default device might have changed now - else
143 149
   // OpenCoreAudio might open the old default device

0 notes on commit f6a002b

Please sign in to comment.
Something went wrong with that request. Please try again.