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>
This commit is contained in:
hjk
2017-08-09 09:23:14 +02:00
parent b7507f3a38
commit c839e86863
3 changed files with 30 additions and 1 deletions

View File

@@ -1586,6 +1586,33 @@ void RunWorker::reportStopped()
emit stopped();
}
/*!
* 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