QTfrontend/net/tcpBase.cpp
branchqmlfrontend
changeset 12860 1b2b84315d27
parent 11071 3851ce4f2061
parent 12829 c75781937859
--- a/QTfrontend/net/tcpBase.cpp	Thu Aug 11 23:05:14 2016 +0300
+++ b/QTfrontend/net/tcpBase.cpp	Sun Dec 17 00:09:24 2017 +0100
@@ -188,7 +188,6 @@
 
 void TCPBase::ClientDisconnect()
 {
-    disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
     onClientDisconnect();
 
     if(!simultaneousRun())
@@ -200,8 +199,11 @@
         emit isReadyNow();
     }
 
-    IPCSocket->deleteLater();
-    IPCSocket = NULL;
+    if(IPCSocket) {
+      disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
+      IPCSocket->deleteLater();
+      IPCSocket = NULL;
+    }
 
     deleteLater();
 }
@@ -224,7 +226,8 @@
 {
     Q_UNUSED(exitStatus);
 
-    ClientDisconnect();
+    if(!m_connected)
+      ClientDisconnect();
 
     // show error message if there was an error that was not an engine's
     // fatal error - because that one already sent a info via IPC
@@ -240,16 +243,6 @@
             .arg("Feedback"));
 
     }
-
-    // cleanup up
-    if (IPCSocket)
-    {
-        IPCSocket->close();
-        IPCSocket->deleteLater();
-    }
-
-    // plot suicide
-    deleteLater();
 }
 
 void TCPBase::tcpServerReady()