cec: don't transmit physical addresses while holding a lock in CCECProcessor
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 11 Jan 2012 00:52:37 +0000 (01:52 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 11 Jan 2012 00:52:37 +0000 (01:52 +0100)
src/lib/CECProcessor.cpp

index 02c1e96498b1295af7025c828d9f3c4812bf28ef..a42921619e5bf874cf3b0c2d8f5063394557ab94 100644 (file)
@@ -607,6 +607,7 @@ bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpda
 {
   bool bSendActiveView(false);
   bool bReturn(false);
+  cec_logical_addresses sendUpdatesTo;
 
   {
     CLockObject lock(&m_mutex);
@@ -620,7 +621,7 @@ bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpda
           m_busDevices[iPtr]->SetInactiveSource();
           m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress);
           if (bSendUpdate)
-            m_busDevices[iPtr]->TransmitPhysicalAddress();
+            sendUpdatesTo.Set((cec_logical_address)iPtr);
         }
 
       bSendActiveView = bWasActiveSource && bSendUpdate;
@@ -628,6 +629,10 @@ bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpda
     }
   }
 
+  for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
+    if (sendUpdatesTo[iPtr])
+      m_busDevices[iPtr]->TransmitPhysicalAddress();
+
   if (bSendActiveView)
     SetActiveView();