Permalink
Browse files

bugfix : do not delete NetServerClient from itself

  • Loading branch information...
1 parent f5e8877 commit d1c905ddb30b332db2d3748c00cf1abd82744a05 Sébastien Escudier committed Dec 21, 2011
Showing with 6 additions and 4 deletions.
  1. +2 −2 network/server/NetServer.cpp
  2. +1 −1 network/server/NetServerClient.cpp
  3. +3 −1 network/server/NetServerClient.h
@@ -118,7 +118,7 @@ void NetServer::incomingClient()
//if freeIndex == 0 && !adminPasswd, this client will be the admin of the server
NetServerClient *client = new NetServerClient(clientConnection,udpSocket,freeIndex, freeIndex == 0 && adminPasswd.isEmpty(), maxNbPlayers, maxWins, this);
- connect(client, SIGNAL(disconected(NetServerClient*)), this, SLOT(clientDisconected(NetServerClient*)));
+ connect(client, SIGNAL(disconected(NetServerClient*)), this, SLOT(clientDisconected(NetServerClient*)), Qt::QueuedConnection);
connect(client, SIGNAL(sigUpdatePlayerData(qint8,QString)), this, SLOT(slotUpdatePlayerData(qint8,QString)));
clients.insert(freeIndex,client);
@@ -325,7 +325,7 @@ void NetServer::kickPlayer(qint8 id)
for (QList<NetServerClient*>::iterator i = clients.begin(); i != clients.end(); ++i) {
if((*i)->getId() == id)
{
- clientDisconected(*i);
+ (*i)->clientDisconected(); //force the deconnection of this client
break;
}
}
@@ -321,6 +321,6 @@ void NetServerClient::sendTcpBlock(const QByteArray& block) {
NetServerClient::~NetServerClient()
{
- tcpSocket->deleteLater();
+ delete tcpSocket;
}
@@ -82,9 +82,11 @@ class NetServerClient : public QObject
quint16 blockSize; //size of the current message
+public slots:
+ void clientDisconected();
+
private slots:
void incomingTcpData();
- void clientDisconected();
signals:
void disconected(NetServerClient*);

0 comments on commit d1c905d

Please sign in to comment.