summaryrefslogtreecommitdiffstats
path: root/src/manager-lib/deinstallationtask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/manager-lib/deinstallationtask.cpp')
-rw-r--r--src/manager-lib/deinstallationtask.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/manager-lib/deinstallationtask.cpp b/src/manager-lib/deinstallationtask.cpp
index 7f0b778b..9b4f2d31 100644
--- a/src/manager-lib/deinstallationtask.cpp
+++ b/src/manager-lib/deinstallationtask.cpp
@@ -29,6 +29,7 @@ DeinstallationTask::DeinstallationTask(const QString &packageId, const QString &
bool DeinstallationTask::cancel()
{
+ QMutexLocker locker(&m_mutex);
if (m_canBeCanceled)
m_canceled = true;
return m_canceled;
@@ -70,10 +71,12 @@ void DeinstallationTask::execute()
while (!m_canceled && !package->areAllApplicationsStoppedDueToBlock())
QThread::msleep(30);
- // there's a small race condition here, but not doing a planned cancellation isn't harmful
- m_canBeCanceled = false;
- if (m_canceled)
- throw Exception(Error::Canceled, "canceled");
+ {
+ QMutexLocker locker(&m_mutex);
+ m_canBeCanceled = false;
+ if (m_canceled)
+ throw Exception(Error::Canceled, "canceled");
+ }
ScopedRenamer docDirRename;
ScopedRenamer appDirRename;