Debug session thread and socket leak fixed:
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.core / src / net / sourceforge / phpdt / internal / debug / core / model / PHPDebugTarget.java
index 9e5dfb8..c86f72b 100644 (file)
@@ -119,7 +119,13 @@ public class PHPDebugTarget implements IPHPDebugTarget, ILaunchListener, IDebugE
                return isTerminated;
        }
 
-       public void terminate() {
+       public synchronized void terminate() {
+               // This method is synchronized to control a race condition between the 
+               // UI thread that terminates the debugging session, and the slave 
+               // thread that executes PHPLoop.run
+               if (isTerminated)
+                       // Avoid terminating twice...
+                       return;
                phpDBGProxy.stop();
                this.threads = new PHPThread[0];
                isTerminated = true;