aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/qbs/commandlinefrontend.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-10-25 12:27:40 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2013-10-28 16:21:26 +0100
commitac02788b396d4bc323729cadec52a29cbbd57eef (patch)
tree13f121fba076ff7a7e30bc30f39675fb989fdded /src/app/qbs/commandlinefrontend.h
parent68514e8cb29bd805b30d393457ef282611364d37 (diff)
Fix potential deadlock in Ctrl-C handling.
The current code calls into the Qt event system from the interrupt handler, which will lead to a deadlock if the interrupt came in during event handling. Change to an approach that does only minimal work in the interrupt handler. Change-Id: Ic4e615939305390efd819b47fa02c7fadb6acf16 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/app/qbs/commandlinefrontend.h')
-rw-r--r--src/app/qbs/commandlinefrontend.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/app/qbs/commandlinefrontend.h b/src/app/qbs/commandlinefrontend.h
index 5c913f957..f988c958b 100644
--- a/src/app/qbs/commandlinefrontend.h
+++ b/src/app/qbs/commandlinefrontend.h
@@ -37,6 +37,10 @@
#include <QList>
#include <QObject>
+QT_BEGIN_NAMESPACE
+class QTimer;
+QT_END_NAMESPACE
+
namespace qbs {
class AbstractJob;
class ConsoleProgressObserver;
@@ -50,6 +54,7 @@ class CommandLineFrontend : public QObject
public:
explicit CommandLineFrontend(const CommandLineParser &parser, Settings *settings,
QObject *parent = 0);
+ ~CommandLineFrontend();
void cancel();
@@ -61,6 +66,7 @@ private slots:
void handleTotalEffortChanged(int totalEffort);
void handleTaskProgress(int value, qbs::AbstractJob *job);
void handleProcessResultReport(const qbs::ProcessResult &result);
+ void checkCancelStatus();
private:
typedef QHash<Project, QList<ProductData> > ProductMap;
@@ -81,8 +87,6 @@ private:
void checkForExactlyOneProduct();
void install();
- Q_INVOKABLE void doCancel();
-
const CommandLineParser &m_parser;
Settings * const m_settings;
QList<AbstractJob *> m_resolveJobs;
@@ -90,7 +94,11 @@ private:
QList<Project> m_projects;
ConsoleProgressObserver *m_observer;
- bool m_canceled;
+
+ enum CancelStatus { CancelStatusNone, CancelStatusRequested, CancelStatusCanceling };
+ CancelStatus m_cancelStatus;
+ QTimer * const m_cancelTimer;
+
int m_buildEffortsNeeded;
int m_buildEffortsRetrieved;
int m_totalBuildEffort;