cec: use CTryLockObject when trying to replace handlers in CCECBusDevice
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 9 Feb 2012 11:59:54 +0000 (12:59 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 9 Feb 2012 11:59:54 +0000 (12:59 +0100)
src/lib/devices/CECBusDevice.cpp

index 2aa29c1d31c2f09818a4833ab100280f2c71ece5..fc85d38f6f0c89854e1addc495156babbb9ff730 100644 (file)
@@ -582,7 +582,10 @@ void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)
 
 bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
 {
-  CLockObject lock(m_mutex);
+  CTryLockObject lock(m_mutex);
+  if (!lock.IsLocked())
+    return false;
+
   CLockObject handlerLock(m_handlerMutex);
 
   if (m_vendor != m_handler->GetVendorId())