small memory leak fixed
authordisplacer
Sat, 03 Feb 2007 00:19:16 +0000
changeset 380 86f3d818da1c
parent 379 e4cd3cd209c6
child 381 6096d74c37da
small memory leak fixed
QTfrontend/tcpBase.cpp
--- a/QTfrontend/tcpBase.cpp	Sat Feb 03 00:04:52 2007 +0000
+++ b/QTfrontend/tcpBase.cpp	Sat Feb 03 00:19:16 2007 +0000
@@ -51,11 +51,10 @@
     // connection should be already finished
     return;
   }
-  QTcpSocket * client = IPCServer->nextPendingConnection();
-  if(!client) return;
-  IPCSocket = client;
-  connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
-  connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
+  IPCSocket = IPCServer->nextPendingConnection();
+  if(!IPCSocket) return;
+  connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
+  connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
   SendToClientFirst();
 }
 
@@ -74,6 +73,8 @@
 void TCPBase::ClientDisconnect()
 {
   IPCSocket->close();
+  delete IPCSocket;
+  IPCSocket = 0;
 
   onClientDisconnect();