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

[tor-commits] [vidalia/master] Fix deadlock when browser process does not launch



commit 1fa42e88f3d6f19a36d3844013eae196e5c41946
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Wed Mar 21 20:46:10 2012 -0300

    Fix deadlock when browser process does not launch
---
 src/vidalia/HelperProcess.cpp |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/vidalia/HelperProcess.cpp b/src/vidalia/HelperProcess.cpp
index b80f151..5c791bf 100644
--- a/src/vidalia/HelperProcess.cpp
+++ b/src/vidalia/HelperProcess.cpp
@@ -137,14 +137,19 @@ HelperProcess::isDone() const
 void
 HelperProcess::toForeground()
 {
-#if defined(Q_WS_MAC) 
+#if defined(Q_WS_MAC)
+  if(state() != QProcess::Running)
+    return;
+
   ProcessSerialNumber psn;
   OSStatus st;
 
   do {
     st = GetProcessForPID(pid(), &psn);
-  } while(st == -600);
+    QCoreApplication::processEvents();
+  } while(st == procNotFound and state() == QProcess::Running);
 
-  SetFrontProcess(&psn);
-#endif 
+  if(st != procNotFound)
+    SetFrontProcess(&psn);
+#endif
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits