Ok, I think I understand about dynamic allocation and using pointers, I try to use that, but still.. it doesn't solve my problem.
I declare CMsgSession *session on CMsgClient private member.
I write this on the constructor :
CMsgClient::CMsgClient()
{
session = new CMsgSession();
}
CMsgClient::CMsgClient()
{
session = new CMsgSession();
}
To copy to clipboard, switch view to plain text mode
And I declare QTcpSocket *tcpSocket on CMsgSession public member, I write this on the constructor :
CMsgSession
::CMsgSession(QObject *parent
) : QThread(parent
), workerQuitFlag
(false){
}
CMsgSession::CMsgSession(QObject *parent) : QThread(parent), workerQuitFlag(false)
{
tcpSocket = new QTcpSocket();
}
To copy to clipboard, switch view to plain text mode
and I access the tcpSocket like this :
session->tcpSocket->write(buf, len);
it causes access violation, it's getting more confusing,
but thanks anyway..
Bookmarks