# HG changeset patch # User unc0rr # Date 1170622091 0 # Node ID 9628e69b609f239f1d00359decd7800dc5d17181 # Parent dcf5335940bd8d7221b7b4335285abacc1c3c198 Fix IPCSocket issues diff -r dcf5335940bd -r 9628e69b609f QTfrontend/tcpBase.cpp --- a/QTfrontend/tcpBase.cpp Sun Feb 04 17:00:46 2007 +0000 +++ b/QTfrontend/tcpBase.cpp Sun Feb 04 20:48:11 2007 +0000 @@ -26,7 +26,7 @@ #include "hwconsts.h" QList srvsList; -QTcpServer* TCPBase::IPCServer(0); +QPointer TCPBase::IPCServer(0); TCPBase::TCPBase(bool demoMode) : m_isDemoMode(demoMode), @@ -51,9 +51,11 @@ // connection should be already finished return; } + disconnect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); 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(); } @@ -62,7 +64,7 @@ { connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); IPCSocket = 0; - + QProcess * process; process = new QProcess; connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError))); @@ -72,10 +74,6 @@ void TCPBase::ClientDisconnect() { - IPCSocket->close(); - IPCSocket->deleteLater(); - // IPCSocket = 0; // FIXME: breaks image receiving - onClientDisconnect(); readbuffer.clear(); @@ -99,7 +97,7 @@ void TCPBase::tcpServerReady() { - disconnect(srvsList.front(), SIGNAL(isReadyNow()), *(++srvsList.begin()), SLOT(tcpServerReady())); + disconnect(srvsList.front(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); srvsList.pop_front(); RealStart(); @@ -114,7 +112,7 @@ srvsList.push_back(this); return; } - + RealStart(); } diff -r dcf5335940bd -r 9628e69b609f QTfrontend/tcpBase.h --- a/QTfrontend/tcpBase.h Sun Feb 04 17:00:46 2007 +0000 +++ b/QTfrontend/tcpBase.h Sun Feb 04 20:48:11 2007 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -34,7 +35,7 @@ class TCPBase : public QObject { Q_OBJECT - + public: TCPBase(bool demoMode); @@ -60,11 +61,11 @@ virtual void SendToClientFirst(); private: - static QTcpServer* IPCServer; + static QPointer IPCServer; bool m_isDemoMode; void RealStart(); - QTcpSocket * IPCSocket; + QPointer IPCSocket; private slots: void NewConnection();