Is there any hidden problem with this code, please? I'w worried about living time of dynamic created "*connection" pointer.
void TMyTCPSrv::incomingConnection(int sockDesc)
{
TConnection *connection = new TConnection(this);
connection->setSocketDescriptor(sockDesc);
// Send read message to this
connect(connection, SIGNAL(toLocalServer(const QString&)),
this, SLOT(onReadFromClient(const QString&)), Qt::QueuedConnection);
}
{
...
};
void TMyTCPSrv::incomingConnection(int sockDesc)
{
TConnection *connection = new TConnection(this);
connection->setSocketDescriptor(sockDesc);
// Send read message to this
connect(connection, SIGNAL(toLocalServer(const QString&)),
this, SLOT(onReadFromClient(const QString&)), Qt::QueuedConnection);
}
class TConnection: public QTcpSocket
{
...
};
To copy to clipboard, switch view to plain text mode
Bookmarks