]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
CleanupPollsJob: Fix possible leak
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 14 Jul 2016 07:21:28 +0000 (09:21 +0200)
committerChristian Kamm <mail@ckamm.de>
Mon, 12 Sep 2016 12:09:12 +0000 (14:09 +0200)
Missing deleteLater when the CleanupPollsJob aborts.
This is only a problem if the SyncEngine is kept alive a long time. Which is
usually not the case in the configuration where poll jobs are used.

(cherry picked from commit 34650248985914523f0684c597f0c366b703f8d7)

src/libsync/owncloudpropagator.cpp
src/libsync/owncloudpropagator.h

index dce440391f32a8dfda436755111f0db9f7d4e1af..72046fccf4cde943af49c2058700ed78633195ad 100644 (file)
@@ -762,6 +762,7 @@ void CleanupPollsJob::slotPollFinished()
     Q_ASSERT(job);
     if (job->_item->_status == SyncFileItem::FatalError) {
         emit aborted(job->_item->_errorString);
+        deleteLater();
         return;
     } else if (job->_item->_status != SyncFileItem::Success) {
         qDebug() << "There was an error with file " << job->_item->_file << job->_item->_errorString;
@@ -771,6 +772,7 @@ void CleanupPollsJob::slotPollFinished()
             job->_item->_status = SyncFileItem::FatalError;
             job->_item->_errorString = tr("Error writing metadata to the database");
             emit aborted(job->_item->_errorString);
+            deleteLater();
             return;
         }
     }
index 7c0a03a2be840debd35983fef1e59f86763fb38d..8e2ce89c3ebcffdd1c8b5800544b47aad77e6d8b 100644 (file)
@@ -410,6 +410,10 @@ public:
 
     ~CleanupPollsJob();
 
+    /**
+     * Start the job.  After the job is completed, it will emit either finished or aborted, and it
+     * will destroy itself.
+     */
     void start();
 signals:
     void finished();