forked from qt-creator/qt-creator
CMake: Fix crash when building a cmake project
Reported by Loaden via mail. Change-Id: I21a9f2ee5787d9271d20f9ed65786d8c7be08d3c Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -66,15 +66,13 @@ const char USE_NINJA_KEY[] = "CMakeProjectManager.MakeStep.UseNinja";
|
|||||||
}
|
}
|
||||||
|
|
||||||
MakeStep::MakeStep(BuildStepList *bsl) :
|
MakeStep::MakeStep(BuildStepList *bsl) :
|
||||||
AbstractProcessStep(bsl, Core::Id(MS_ID)), m_clean(false),
|
AbstractProcessStep(bsl, Core::Id(MS_ID)), m_clean(false)
|
||||||
m_futureInterface(0)
|
|
||||||
{
|
{
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeStep::MakeStep(BuildStepList *bsl, const Core::Id id) :
|
MakeStep::MakeStep(BuildStepList *bsl, const Core::Id id) :
|
||||||
AbstractProcessStep(bsl, id), m_clean(false),
|
AbstractProcessStep(bsl, id), m_clean(false)
|
||||||
m_futureInterface(0)
|
|
||||||
{
|
{
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
@@ -82,7 +80,6 @@ MakeStep::MakeStep(BuildStepList *bsl, const Core::Id id) :
|
|||||||
MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) :
|
MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) :
|
||||||
AbstractProcessStep(bsl, bs),
|
AbstractProcessStep(bsl, bs),
|
||||||
m_clean(bs->m_clean),
|
m_clean(bs->m_clean),
|
||||||
m_futureInterface(0),
|
|
||||||
m_buildTargets(bs->m_buildTargets),
|
m_buildTargets(bs->m_buildTargets),
|
||||||
m_additionalArguments(Utils::QtcProcess::joinArgs(bs->m_buildTargets))
|
m_additionalArguments(Utils::QtcProcess::joinArgs(bs->m_buildTargets))
|
||||||
{
|
{
|
||||||
@@ -223,12 +220,7 @@ void MakeStep::run(QFutureInterface<bool> &fi)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_futureInterface = &fi;
|
|
||||||
m_futureInterface->setProgressRange(0, 100);
|
|
||||||
AbstractProcessStep::run(fi);
|
AbstractProcessStep::run(fi);
|
||||||
m_futureInterface->setProgressValue(100);
|
|
||||||
m_futureInterface->reportFinished();
|
|
||||||
m_futureInterface = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||||
@@ -247,7 +239,7 @@ void MakeStep::stdOutput(const QString &line)
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
int percent = m_percentProgress.cap(1).toInt(&ok);;
|
int percent = m_percentProgress.cap(1).toInt(&ok);;
|
||||||
if (ok)
|
if (ok)
|
||||||
m_futureInterface->setProgressValue(percent);
|
futureInterface()->setProgressValue(percent);
|
||||||
} else if (m_ninjaProgress.indexIn(line) != -1) {
|
} else if (m_ninjaProgress.indexIn(line) != -1) {
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int done = m_ninjaProgress.cap(1).toInt(&ok);
|
int done = m_ninjaProgress.cap(1).toInt(&ok);
|
||||||
@@ -255,7 +247,7 @@ void MakeStep::stdOutput(const QString &line)
|
|||||||
int all = m_ninjaProgress.cap(2).toInt(&ok);
|
int all = m_ninjaProgress.cap(2).toInt(&ok);
|
||||||
if (ok && all != 0) {
|
if (ok && all != 0) {
|
||||||
int percent = 100.0 * done/all;
|
int percent = 100.0 * done/all;
|
||||||
m_futureInterface->setProgressValue(percent);
|
futureInterface()->setProgressValue(percent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ private:
|
|||||||
QRegExp m_percentProgress;
|
QRegExp m_percentProgress;
|
||||||
QRegExp m_ninjaProgress;
|
QRegExp m_ninjaProgress;
|
||||||
QString m_ninjaProgressString;
|
QString m_ninjaProgressString;
|
||||||
QFutureInterface<bool> *m_futureInterface;
|
|
||||||
QStringList m_buildTargets;
|
QStringList m_buildTargets;
|
||||||
QString m_additionalArguments;
|
QString m_additionalArguments;
|
||||||
QList<ProjectExplorer::Task> m_tasks;
|
QList<ProjectExplorer::Task> m_tasks;
|
||||||
|
|||||||
@@ -344,6 +344,11 @@ void AbstractProcessStep::stdError(const QString &line)
|
|||||||
emit addOutput(line, BuildStep::ErrorOutput, BuildStep::DontAppendNewline);
|
emit addOutput(line, BuildStep::ErrorOutput, BuildStep::DontAppendNewline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFutureInterface<bool> *AbstractProcessStep::futureInterface() const
|
||||||
|
{
|
||||||
|
return m_futureInterface;
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractProcessStep::checkForCancel()
|
void AbstractProcessStep::checkForCancel()
|
||||||
{
|
{
|
||||||
if (m_futureInterface->isCanceled() && m_timer->isActive()) {
|
if (m_futureInterface->isCanceled() && m_timer->isActive()) {
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ protected:
|
|||||||
virtual void stdOutput(const QString &line);
|
virtual void stdOutput(const QString &line);
|
||||||
virtual void stdError(const QString &line);
|
virtual void stdError(const QString &line);
|
||||||
|
|
||||||
|
QFutureInterface<bool> *futureInterface() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void processReadyReadStdOutput();
|
void processReadyReadStdOutput();
|
||||||
void processReadyReadStdError();
|
void processReadyReadStdError();
|
||||||
|
|||||||
Reference in New Issue
Block a user