[SCM] ktp-filetransfer-handler packaging branch, master, updated. debian/15.12.1-2-226-g825cd93

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:11:31 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-filetransfer-handler.git;a=commitdiff;h=e05c32c

The following commit has been merged in the master branch:
commit e05c32cc79fe5bf34a538709e7015051d7cf42d6
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Sat Sep 3 19:04:43 2011 +0100

    Use QWeakPointer instead of QPointer
    
    Also check that the QWeakPointer is not null after exec() and delete the
    rename dialog at the end.
    
    Reviewed-by: George Kiagiadakis <kiagiadakis.george at gmail.com>
    Reviewed-by: Olli Salli <olli.salli at collabora.co.uk>
---
 src/handle-incoming-file-transfer-channel-job.cpp | 41 ++++++++++++++---------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/handle-incoming-file-transfer-channel-job.cpp b/src/handle-incoming-file-transfer-channel-job.cpp
index 5441bc9..efe8fc2 100644
--- a/src/handle-incoming-file-transfer-channel-job.cpp
+++ b/src/handle-incoming-file-transfer-channel-job.cpp
@@ -21,7 +21,7 @@
 #include "telepathy-base-job_p.h"
 
 #include <QtCore/QTimer>
-#include <QtCore/QPointer>
+#include <QtCore/QWeakPointer>
 
 #include <KLocalizedString>
 #include <KDebug>
@@ -131,19 +131,28 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__start()
     QFileInfo fileInfo(url.toLocalFile());
     if (fileInfo.exists()) // TODO check if it is a dir?
     {
-        QPointer<KIO::RenameDialog> renameDialog = new KIO::RenameDialog(0,
-                                                                         i18n("Incoming file exists"),
-                                                                         KUrl(), //TODO
-                                                                         url,
-                                                                         KIO::M_OVERWRITE,
-                                                                         fileInfo.size(),
-                                                                         channel->size(),
-                                                                         fileInfo.created().toTime_t(),
-                                                                         time_t(-1),
-                                                                         fileInfo.lastModified().toTime_t(),
-                                                                         channel->lastModificationTime().toTime_t());
-        renameDialog->exec();
-        switch (renameDialog->result())
+        QWeakPointer<KIO::RenameDialog> renameDialog = new KIO::RenameDialog(0,
+                                                                             i18n("Incoming file exists"),
+                                                                             KUrl(), //TODO
+                                                                             url,
+                                                                             KIO::M_OVERWRITE,
+                                                                             fileInfo.size(),
+                                                                             channel->size(),
+                                                                             fileInfo.created().toTime_t(),
+                                                                             time_t(-1),
+                                                                             fileInfo.lastModified().toTime_t(),
+                                                                             channel->lastModificationTime().toTime_t());
+
+        renameDialog.data()->exec();
+
+        if (!renameDialog)
+        {
+            kWarning() << "Rename dialog was deleted during event loop.";
+            QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+            return;
+        }
+
+        switch (renameDialog.data()->result())
         {
             case KIO::R_CANCEL:
                 // TODO Cancel file transfer and close channel
@@ -151,7 +160,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__start()
                 QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
                 return;
             case KIO::R_RENAME:
-                url = renameDialog->newDestUrl();
+                url = renameDialog.data()->newDestUrl();
                 break;
             case KIO::R_OVERWRITE:
                 break;
@@ -159,9 +168,11 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__start()
                 kWarning() << "Unknown Error";
                 q->setError(KTelepathy::KTelepathyError);
                 q->setErrorText(i18n("Unknown Error"));
+                renameDialog.data()->deleteLater();
                 QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
                 return;
         }
+        renameDialog.data()->deleteLater();
     }
 
     // TODO check if a .part file already exists ask user if file should be

-- 
ktp-filetransfer-handler packaging



More information about the pkg-kde-commits mailing list