Access to mySequence and mySocket is in synchronized contexts only (PY-13927)
authorElizaveta Shashkova <Elizaveta.Shashkova@jetbrains.com>
Tue, 24 Feb 2015 14:44:46 +0000 (17:44 +0300)
committerElizaveta Shashkova <Elizaveta.Shashkova@jetbrains.com>
Tue, 24 Feb 2015 14:44:46 +0000 (17:44 +0300)
python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java

index e39f45f1b3a98b4cc3b0b057d1e8e33a2aabadf9..fce54b4e6581cc6d1cecd22ddef9083815fc4e32 100644 (file)
@@ -98,7 +98,7 @@ public class RemoteDebugger implements ProcessDebugger {
 
     if (myConnected) {
       try {
-        myDebuggerReader = createReader(mySocket);
+        myDebuggerReader = createReader();
       }
       catch (Exception e) {
         synchronized (mySocketObject) {
@@ -231,7 +231,9 @@ public class RemoteDebugger implements ProcessDebugger {
   private void cleanUp() {
     myThreads.clear();
     myResponseQueue.clear();
-    mySequence = -1;
+    synchronized (mySequenceObject) {
+      mySequence = -1;
+    }
     myTempVars.clear();
   }
 
@@ -477,10 +479,10 @@ public class RemoteDebugger implements ProcessDebugger {
     execute(command);
   }
 
-  public DebuggerReader createReader(@NotNull Socket socket) throws IOException {
+  private DebuggerReader createReader() throws IOException {
     synchronized (mySocketObject) {
       //noinspection IOResourceOpenedButNotSafelyClosed
-      return new DebuggerReader(socket.getInputStream());
+      return new DebuggerReader(mySocket.getInputStream());
     }
   }