[cec] extra guards around m_queryThread
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 12 Mar 2013 09:20:27 +0000 (10:20 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 12 Mar 2013 11:00:04 +0000 (12:00 +0100)
xbmc/peripherals/devices/PeripheralCecAdapter.cpp

index 4cdd3c4..6509c5d 100644 (file)
@@ -99,8 +99,8 @@ CPeripheralCecAdapter::~CPeripheralCecAdapter(void)
     m_bStop = true;
   }
 
-  SAFE_DELETE(m_queryThread);
   StopThread(true);
+  delete m_queryThread;
 
   if (m_dll && m_cecAdapter)
   {
@@ -389,7 +389,7 @@ void CPeripheralCecAdapter::Process(void)
       Sleep(5);
   }
 
-  SAFE_DELETE(m_queryThread);
+  m_queryThread->StopThread(true);
 
   bool bSendStandbyCommands(false);
   {
@@ -1105,9 +1105,12 @@ void CPeripheralCecAdapter::OnSettingChanged(const CStdString &strChangedSetting
   }
   else if (IsRunning())
   {
-    CLog::Log(LOGDEBUG, "%s - sending the updated configuration to libCEC", __FUNCTION__);
-    SetConfigurationFromSettings();
-    m_queryThread->UpdateConfiguration(&m_configuration);
+    if (m_queryThread->IsRunning())
+    {
+      CLog::Log(LOGDEBUG, "%s - sending the updated configuration to libCEC", __FUNCTION__);
+      SetConfigurationFromSettings();
+      m_queryThread->UpdateConfiguration(&m_configuration);
+    }
   }
   else
   {