diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-07-17 15:48:36 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-07-21 08:21:51 +0000 |
commit | 20825b73d125c689a13a154266d2bbda0aab2a15 (patch) | |
tree | 84445451377ad5e4a26bc4b58d972529a17dbde1 /src/lib/corelib/buildgraph/jscommandexecutor.cpp | |
parent | a5d801e02c284da024ee91f8b1a122f490db7f75 (diff) |
JsCommandExecutor: Try harder not to cancel non-running commands
It is not entirely clear that this fixes the linked crash (which is not
reproducible), but it eliminates the only potentially questionable code
path, which is calling abortEvaluation() on the script engine after its
thread has finished.
Task-number: QTCREATORBUG-18569
Change-Id: I22296644505397a17f7b81dd534ed122f2477a11
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/jscommandexecutor.cpp')
-rw-r--r-- | src/lib/corelib/buildgraph/jscommandexecutor.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/corelib/buildgraph/jscommandexecutor.cpp b/src/lib/corelib/buildgraph/jscommandexecutor.cpp index 9865893df..7bfda7881 100644 --- a/src/lib/corelib/buildgraph/jscommandexecutor.cpp +++ b/src/lib/corelib/buildgraph/jscommandexecutor.cpp @@ -93,12 +93,14 @@ signals: public: void start(const JavaScriptCommand *cmd, Transformer *transformer) { + m_running = true; try { doStart(cmd, transformer); } catch (const qbs::ErrorInfo &error) { setError(error.toString(), cmd->codeLocation()); } + m_running = false; emit finished(); } @@ -163,6 +165,7 @@ private: Logger m_logger; ScriptEngine *m_scriptEngine; JavaScriptCommandResult m_result; + bool m_running = false; }; @@ -224,7 +227,7 @@ void JsCommandExecutor::doStart() void JsCommandExecutor::cancel() { - if (!dryRun()) + if (m_running && !dryRun()) QTimer::singleShot(0, m_objectInThread, [this] { m_objectInThread->cancel(); }); } |