Fixed crash
QIODevice was deleted when DownloadJob was autodeleted, causing dangling pointers.
This commit is contained in:
parent
f8825e013e
commit
ddbbafab63
1 changed files with 3 additions and 1 deletions
|
@ -23,12 +23,13 @@
|
|||
DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob()
|
||||
{
|
||||
mPort = transferInfo["port"].toInt();
|
||||
mSocket = new QTcpSocket(this);
|
||||
mSocket = new QTcpSocket();
|
||||
mAddress = address;
|
||||
}
|
||||
|
||||
void DownloadJob::start()
|
||||
{
|
||||
qDebug() << "start";
|
||||
mSocket->connectToHost(mAddress, mPort, QIODevice::ReadOnly);
|
||||
connect(mSocket, SIGNAL(disconnected()), this, SLOT(disconnected()));
|
||||
}
|
||||
|
@ -40,5 +41,6 @@ void DownloadJob::disconnected()
|
|||
|
||||
QIODevice* DownloadJob::getPayload()
|
||||
{
|
||||
qDebug() << "getPayload";
|
||||
return mSocket;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue