forked from qt-creator/qt-creator
Clang: Take over jobs if document's project changes
On registerProjectPartsForEditor() we recreated the affected DocumentProcessors, but did not take care of the jobs that were in the queue, which effectively could led to lost jobs. Catch up on this. Task-number: QTCREATORBUG-18856 Change-Id: I4184e5dc6480667953f2d2081ccf39a28c092186 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -113,6 +113,20 @@ JobRequests Jobs::process()
|
||||
return jobsStarted;
|
||||
}
|
||||
|
||||
JobRequests Jobs::stop()
|
||||
{
|
||||
// Take the queued jobs to prevent processing them.
|
||||
const JobRequests queuedJobs = queue();
|
||||
queue().clear();
|
||||
|
||||
// Wait until currently running jobs finish.
|
||||
QFutureSynchronizer<void> waitForFinishedJobs;
|
||||
foreach (const RunningJob &runningJob, m_running.values())
|
||||
waitForFinishedJobs.addFuture(runningJob.future);
|
||||
|
||||
return queuedJobs;
|
||||
}
|
||||
|
||||
JobRequests Jobs::runJobs(const JobRequests &jobsRequests)
|
||||
{
|
||||
JobRequests jobsStarted;
|
||||
@@ -166,6 +180,11 @@ void Jobs::onJobFinished(IAsyncJob *asyncJob)
|
||||
process();
|
||||
}
|
||||
|
||||
Jobs::JobFinishedCallback Jobs::jobFinishedCallback() const
|
||||
{
|
||||
return m_jobFinishedCallback;
|
||||
}
|
||||
|
||||
void Jobs::setJobFinishedCallback(const JobFinishedCallback &jobFinishedCallback)
|
||||
{
|
||||
m_jobFinishedCallback = jobFinishedCallback;
|
||||
|
||||
Reference in New Issue
Block a user