[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r1625: Fix a race condition that could (and did) cause Vidalia to f (in trunk: . src/control)



Author: edmanm
Date: 2007-02-03 17:57:48 -0500 (Sat, 03 Feb 2007)
New Revision: 1625

Modified:
   trunk/
   trunk/src/control/controlconnection.cpp
Log:
 r1648@adrastea:  edmanm | 2007-02-03 17:55:00 -0500
 Fix a race condition that could (and did) cause Vidalia to freeze.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /vidalia/local/trunk [r1648] on 54b3572a-7227-0410-958f-53ecd705b71a

Modified: trunk/src/control/controlconnection.cpp
===================================================================
--- trunk/src/control/controlconnection.cpp	2007-01-31 09:44:40 UTC (rev 1624)
+++ trunk/src/control/controlconnection.cpp	2007-02-03 22:57:48 UTC (rev 1625)
@@ -318,12 +318,12 @@
 ControlConnection::ReceiveWaiter::setResult(bool success, 
                                             ControlReply reply, 
                                             QString errmsg)
-{ 
+{
+  QMutexLocker locker(&_mutex);
   _status = (success ? Success : Failed);
   _reply = reply; 
   _errmsg = errmsg;
   _waitCond.wakeAll();
-
 }
 
 
@@ -334,10 +334,9 @@
 void
 ControlConnection::SendWaiter::setResult(bool success, QString errmsg)
 {
-  _mutex.lock();
+  QMutexLocker locker(&_mutex);
   _status = (success ? Success : Failed);
   _errmsg = errmsg;
-  _mutex.unlock();
   _waitCond.wakeAll();
 }