From: Lars Op den Kamp Date: Thu, 9 Feb 2012 11:59:54 +0000 (+0100) Subject: cec: use CTryLockObject when trying to replace handlers in CCECBusDevice X-Git-Tag: upstream/2.2.0~1^2~35^2~130 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2563e7ebe9a465b5905bfe2b710975db5cd4d1c8;p=deb_libcec.git cec: use CTryLockObject when trying to replace handlers in CCECBusDevice --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 2aa29c1..fc85d38 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -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())