QTfrontend/tcpBase.cpp
changeset 443 eec37eb7f5db
parent 419 fdeed9718e6b
child 486 7ea71cd3acd5
--- a/QTfrontend/tcpBase.cpp	Wed Feb 14 20:05:20 2007 +0000
+++ b/QTfrontend/tcpBase.cpp	Wed Feb 14 22:15:55 2007 +0000
@@ -59,7 +59,6 @@
   IPCSocket = IPCServer->nextPendingConnection();
   if(!IPCSocket) return;
   connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
-  connect(IPCSocket, SIGNAL(disconnected()), IPCSocket, SLOT(deleteLater()));
   connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
   SendToClientFirst();
 }
@@ -78,16 +77,20 @@
 
 void TCPBase::ClientDisconnect()
 {
+  disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
   onClientDisconnect();
 
   if(srvsList.size()==1) srvsList.pop_front();
   emit isReadyNow();
+  IPCSocket->deleteLater();
   deleteLater();
 }
 
 void TCPBase::ClientRead()
 {
-  readbuffer.append(IPCSocket->readAll());
+  QByteArray readed=IPCSocket->readAll();
+  if(readed.isEmpty()) return;
+  readbuffer.append(readed);
   onClientRead();
 }