forked from qt-creator/qt-creator
CMake: Do not react to builds in the background
If an error occurs while persisting or updating the cmake state, the build might continue for a while in the background. CMakeBuildStep does not disconnect the Error/Run-Trigger when an error is signaled by the CMakeBuildConfiguration. Instead it reports the build as finished (with error). The BuildManager then disconnects the output and runs the next item in the build queue (if any). However the cmake step might still be alive and emits the dataAvailable signal which then triggers the build process. Task-number: QTCREATORBUG-18382 Change-Id: I956133fe8c6f7de58b9f842b231c70d24778b1e0 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tobias Hunger
parent
523439d71b
commit
8542ebcd5d
@@ -267,7 +267,7 @@ void CMakeBuildStep::run(QFutureInterface<bool> &fi)
|
||||
m_runTrigger = connect(bc, &CMakeBuildConfiguration::dataAvailable,
|
||||
this, [this, &fi]() { runImpl(fi); });
|
||||
m_errorTrigger = connect(bc, &CMakeBuildConfiguration::errorOccured,
|
||||
this, [this, &fi]() { reportRunResult(fi, false); });
|
||||
this, [this, &fi](const QString& em) { handleCMakeError(fi, em); });
|
||||
} else {
|
||||
runImpl(fi);
|
||||
}
|
||||
@@ -276,10 +276,21 @@ void CMakeBuildStep::run(QFutureInterface<bool> &fi)
|
||||
void CMakeBuildStep::runImpl(QFutureInterface<bool> &fi)
|
||||
{
|
||||
// Do the actual build:
|
||||
disconnectTriggers();
|
||||
AbstractProcessStep::run(fi);
|
||||
}
|
||||
|
||||
void CMakeBuildStep::handleCMakeError(QFutureInterface<bool> &fi, const QString& errorMessage)
|
||||
{
|
||||
disconnectTriggers();
|
||||
AbstractProcessStep::stdError(tr("Error parsing CMake: %1\n").arg(errorMessage));
|
||||
reportRunResult(fi, false);
|
||||
}
|
||||
|
||||
void CMakeBuildStep::disconnectTriggers()
|
||||
{
|
||||
disconnect(m_runTrigger);
|
||||
disconnect(m_errorTrigger);
|
||||
|
||||
AbstractProcessStep::run(fi);
|
||||
}
|
||||
|
||||
BuildStepConfigWidget *CMakeBuildStep::createConfigWidget()
|
||||
|
@@ -104,6 +104,8 @@ private:
|
||||
void ctor(ProjectExplorer::BuildStepList *bsl);
|
||||
|
||||
void runImpl(QFutureInterface<bool> &fi);
|
||||
void handleCMakeError(QFutureInterface<bool> &fi, const QString& errorMessage);
|
||||
void disconnectTriggers();
|
||||
|
||||
void handleBuildTargetChanges();
|
||||
CMakeRunConfiguration *targetsActiveRunConfiguration() const;
|
||||
|
Reference in New Issue
Block a user