I use a QTcpSocket
in a dedicated thread. For close this thread, I have a personal slot connected with the disconnected
signal of the QTcpSocket
. This slot contains the socket.close()
instruction.
class Network
{
private:
QTcpSocket *mp_Socket;
public:
void connection()
{
mp_Socket = new QTcpSocket(this);
// Move to thread
connect(mp_Socket, SIGNAL(disconnected()), this, SLOT(disconnect()));
}
public slots:
void disconnect()
{
mp_Socket->close();
}
};
Here, the slot works (even if the socket is in another thread). But if I call the disconnect slot by myself, i have the following error :
"QSocketNotifier: socket notifiers cannot be disabled from another thread".
Why?
Thanks for your help. ;)