diff options
author | kh1 <karsten.heimrich@digia.com> | 2014-06-13 17:53:39 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2014-06-16 17:56:46 +0200 |
commit | 995fd6b3e38d3976aa772e8d33d44daa6a4461b9 (patch) | |
tree | 1a7d9479c40ae263cc11523e21a25661a92e058f /src | |
parent | 0c478e02cb25933e203cb62eca995d3215cf1cb8 (diff) |
Fix crash while canceling the meta data unzip task.
The crash happens cause in reset we do a delete later on the
unzip tasks and then a second delete while not checking early
enough for the set error code.
Change-Id: Iee17cd6863435d25c0c999fb0cc4e05672de3cc8
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/metadatajob.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp index 0f4c8b74b..67e163bef 100644 --- a/src/libs/installer/metadatajob.cpp +++ b/src/libs/installer/metadatajob.cpp @@ -162,12 +162,14 @@ void MetadataJob::unzipTaskFinished() reset(); emitFinishedWithError(QInstaller::DownloadError, tr("Unknown exception during extracting.")); } + + if (error() != KDJob::NoError) + return; + delete m_unzipTasks.value(watcher); m_unzipTasks.remove(watcher); delete watcher; - if (error() != KDJob::NoError) - return; if (m_unzipTasks.isEmpty()) { setProcessedAmount(100); emitFinished(); @@ -226,10 +228,13 @@ void MetadataJob::reset() try { m_xmlTask.cancel(); m_metadataTask.cancel(); - foreach (QFutureWatcher<void> *const watcher, m_unzipTasks.keys()) + foreach (QFutureWatcher<void> *const watcher, m_unzipTasks.keys()) { watcher->cancel(); + watcher->deleteLater(); + } foreach (QObject *const object, m_unzipTasks) object->deleteLater(); + m_unzipTasks.clear(); } catch (...) {} m_tempDirDeleter.releaseAndDeleteAll(); } |