diff options
author | hjk <hjk@qt.io> | 2017-08-09 09:23:14 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-08-09 14:12:45 +0000 |
commit | c839e86863b590d7339e6fda745fa940140af694 (patch) | |
tree | 3e2609ec6c95bf7cec88d11d396b6a0bd1632c39 | |
parent | b7507f3a3871a1bb121a9c7f79a09811aea3ddde (diff) | |
download | qt-creator-c839e86863b590d7339e6fda745fa940140af694.tar.gz |
ProjectExplorer: Introduce RunWorker::reportDone()
To be used for short-lived tasks to signal that they are done.
Essentially an optional reportStarted() followed by reportStopped()
Using it in GdbServerPortsGatherer when the port list is ready fixes
the wrong "un-stopped" situation in RemoteLinux debugging when
the inferior finishes by itself.
Change-Id: I310831a7875fe6f2c598302b73cda6c9669efb1d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/plugins/debugger/debuggerruncontrol.cpp | 2 | ||||
-rw-r--r-- | src/plugins/projectexplorer/runconfiguration.cpp | 27 | ||||
-rw-r--r-- | src/plugins/projectexplorer/runconfiguration.h | 2 |
3 files changed, 30 insertions, 1 deletions
diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 0ed11b84f5..c60d432482 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -685,7 +685,7 @@ void GdbServerPortsGatherer::handlePortListReady() return; } } - reportStarted(); + reportDone(); } // GdbServerRunner diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 8a08688fd4..9ab4421ff4 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -1587,6 +1587,33 @@ void RunWorker::reportStopped() } /*! + * This function can be called by a RunWorker implementation for short-lived + * tasks to notify its RunControl about this task being successful finished. + * Dependent startup tasks can proceed, in cases of spontaneous or scheduled + * stops, the effect is the same as \c reportStopped(). + * + */ +void RunWorker::reportDone() +{ + switch (d->state) { + case RunWorkerState::Initialized: + QTC_CHECK(false); + d->state = RunWorkerState::Done; + break; + case RunWorkerState::Starting: + reportStarted(); + reportStopped(); + break; + case RunWorkerState::Running: + case RunWorkerState::Stopping: + reportStopped(); + break; + case RunWorkerState::Done: + break; + } +} + +/*! * This function can be called by a RunWorker implementation to * signal a problem in the operation in this worker. The * RunControl will start to ramp down through initiateStop(). diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index 80c1631d63..0460735206 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -347,6 +347,8 @@ public: void initiateStop(); void reportStopped(); + void reportDone(); + void reportFailure(const QString &msg = QString()); void setSupportsReRunning(bool reRunningSupported); bool supportsReRunning() const; |