From 65c49e1de6b5810136753cf359eefe7ccd49dc0e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 14 Jul 2016 09:21:28 +0200 Subject: [PATCH] CleanupPollsJob: Fix possible leak 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 | 2 ++ src/libsync/owncloudpropagator.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index dce440391f..72046fccf4 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -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; } } diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index 7c0a03a2be..8e2ce89c3e 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -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();