[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [partitionmanager] src/gui: Fix mutex logic for cancelling operations.
From:       Andrius_Å tikonas <null () kde ! org>
Date:       2018-03-31 19:18:23
Message-ID: E1f2M19-0007rP-6H () code ! kde ! org
[Download RAW message or body]

Git commit 2bbf89af2891d429b6dfd6c9f81ee0d0476dabab by Andrius Å tikonas.
Committed on 31/03/2018 at 19:17.
Pushed by stikonas into branch 'master'.

Fix mutex logic for cancelling operations.

M  +10   -11   src/gui/applyprogressdialog.cpp

https://commits.kde.org/partitionmanager/2bbf89af2891d429b6dfd6c9f81ee0d0476dabab

diff --git a/src/gui/applyprogressdialog.cpp b/src/gui/applyprogressdialog.cpp
index 8b35a2f..d9c1ae1 100644
--- a/src/gui/applyprogressdialog.cpp
+++ b/src/gui/applyprogressdialog.cpp
@@ -144,6 +144,8 @@ void ApplyProgressDialog::show()
     dialogWidget().treeTasks().clear();
     okButton->setVisible(false);
     cancelButton->setVisible(true);
+    cancelButton->setEnabled(true);
+
 
     timer().start(1000);
     time().start();
@@ -194,24 +196,21 @@ void ApplyProgressDialog::onCancelButton()
         if (operationRunner().isCancelling())
             return;
 
-        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-
-        cancelButton->setEnabled(false);
-        setStatus(xi18nc("@info:progress", "Waiting for operation to finish..."));
-        repaint();
-        dialogWidget().repaint();
-
         // suspend the runner, so it doesn't happily carry on while the user decides
         // if he really wants to cancel
         operationRunner().suspendMutex().lock();
-        cancelButton->setEnabled(true);
-
-        QApplication::restoreOverrideCursor();
 
         if (KMessageBox::questionYesNo(this, xi18nc("@info", "Do you really want to \
cancel?"), xi18nc("@title:window", "Cancel Running Operations"), \
KGuiItem(xi18nc("@action:button", "Yes, Cancel Operations"), \
                QStringLiteral("dialog-ok")), KStandardGuiItem::no()) == \
                KMessageBox::Yes)
             // in the meantime while we were showing the messagebox, the runner \
                might have finished.
-            if (operationRunner().isRunning())
+            if (operationRunner().isRunning()) {
+                QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+                cancelButton->setEnabled(false);
+                setStatus(xi18nc("@info:progress", "Waiting for operation to \
finish...")); +                repaint();
+                dialogWidget().repaint();
+                QApplication::restoreOverrideCursor();
                 operationRunner().cancel();
+            }
 
         operationRunner().suspendMutex().unlock();
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic