aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppTransferManager.cpp
diff options
context:
space:
mode:
authorAlexandr Akulich <akulichalexander@gmail.com>2015-09-29 16:47:45 +0500
committerAlexandr Akulich <akulichalexander@gmail.com>2015-10-27 19:49:16 +0500
commitb6876733ba4d49d99269a290c170b1c3716e35d4 (patch)
treead806422d40b7234db84f545fa6bcd9df2cd2ee3 /src/client/QXmppTransferManager.cpp
parent2f942c6b75305ec6b3fa471d2381a5f04cd44ee3 (diff)
downloadqxmpp-b6876733ba4d49d99269a290c170b1c3716e35d4.tar.gz
QXmppTransferManager: Fixed device ownership.
- sendFile() without a device argument now set Job as a parent for the constructed (own) device. - sendFile() with a device argument does not reparent the device anymore.
Diffstat (limited to 'src/client/QXmppTransferManager.cpp')
-rw-r--r--src/client/QXmppTransferManager.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/client/QXmppTransferManager.cpp b/src/client/QXmppTransferManager.cpp
index 6fb2da75..0784279e 100644
--- a/src/client/QXmppTransferManager.cpp
+++ b/src/client/QXmppTransferManager.cpp
@@ -1307,7 +1307,7 @@ QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QStri
fileInfo.setDescription(description);
// open file
- QIODevice *device = new QFile(filePath);
+ QIODevice *device = new QFile(filePath, this);
if (!device->open(QIODevice::ReadOnly))
{
warning(QString("Could not read from %1").arg(filePath));
@@ -1342,6 +1342,7 @@ QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QStri
/// Returns 0 if the \a jid is not valid.
///
/// \note The recipient's \a jid must be a full JID with a resource, for instance "user@host/resource".
+/// \note The ownership of the \a device should be managed by the caller.
///
QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, QIODevice *device, const QXmppTransferFileInfo &fileInfo, const QString &sid)
@@ -1361,8 +1362,6 @@ QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, QIODevice *
job->d->sid = sid;
job->d->fileInfo = fileInfo;
job->d->iodevice = device;
- if (device)
- device->setParent(job);
// check file is open
if (!device || !device->isReadable())