Commit ddbbafab authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Fixed crash

QIODevice was deleted when DownloadJob was autodeleted, causing dangling
pointers.
parent f8825e01
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob() DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob()
{ {
mPort = transferInfo["port"].toInt(); mPort = transferInfo["port"].toInt();
mSocket = new QTcpSocket(this); mSocket = new QTcpSocket();
mAddress = address; mAddress = address;
} }
void DownloadJob::start() void DownloadJob::start()
{ {
qDebug() << "start";
mSocket->connectToHost(mAddress, mPort, QIODevice::ReadOnly); mSocket->connectToHost(mAddress, mPort, QIODevice::ReadOnly);
connect(mSocket, SIGNAL(disconnected()), this, SLOT(disconnected())); connect(mSocket, SIGNAL(disconnected()), this, SLOT(disconnected()));
} }
...@@ -40,5 +41,6 @@ void DownloadJob::disconnected() ...@@ -40,5 +41,6 @@ void DownloadJob::disconnected()
QIODevice* DownloadJob::getPayload() QIODevice* DownloadJob::getPayload()
{ {
qDebug() << "getPayload";
return mSocket; return mSocket;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment