From 04a716ac913ad2c7311756dace7c2d2de8ec8909 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 29 Mar 2007 10:06:55 +0000 Subject: [PATCH] - Fixed a mutex lock in UPnP code --- src/UPnP.cpp | 7 +++++-- src/UPnP.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/UPnP.cpp b/src/UPnP.cpp index a0abba8b5..6469bb7ca 100644 --- a/src/UPnP.cpp +++ b/src/UPnP.cpp @@ -1033,7 +1033,9 @@ m_UPnPPort(udpPort) // Lock it again, so that we block. Unlocking will only happen // when the UPNP_DISCOVERY_SEARCH_TIMEOUT event occurs at the // callback. - QMutexLocker lock(&m_WaitForSearchTimeout); + searchTimeoutCondition.wait(&m_WaitForSearchTimeout); +// QMutexLocker lock(&m_WaitForSearchTimeout);s + m_WaitForSearchTimeout.unlock(); } return; @@ -1364,7 +1366,8 @@ upnpDiscovery: qDebug("UPnP: %s", msg.str().c_str()); // Unlock the search timeout mutex - upnpCP->m_WaitForSearchTimeout.unlock(); +// upnpCP->m_WaitForSearchTimeout.unlock(); + upnpCP->searchTimeoutCondition.wakeOne(); break; } diff --git a/src/UPnP.h b/src/UPnP.h index 410a1a3f3..2f175839e 100644 --- a/src/UPnP.h +++ b/src/UPnP.h @@ -45,6 +45,7 @@ extern std::string stdEmptyString; #endif // UPNP_C +#include /** * Case insensitive std::string comparison @@ -640,6 +641,7 @@ private: bool m_IGWDeviceDetected; CUPnPService *m_WanService; QMutex m_WaitForSearchTimeout; + QWaitCondition searchTimeoutCondition; unsigned short m_UPnPPort; public: