Commit 5031c49c authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

Clang: Fix crash if updating pch info



Function-local variable 'updateParams' was referenced after destruction.

Change-Id: Iac9663ba4ca9c3a603bc530f57f419b734782694
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent b7ebfd27
......@@ -161,7 +161,7 @@ void PchManager::updatePchInfo(ClangProjectSettings *cps,
const ClangProjectSettings::PchUsage pchUsage = cps->pchUsage();
void (*updateFunction)(QFutureInterface<void> &future,
const PchManager::UpdateParams &params) = 0;
const PchManager::UpdateParams params) = 0;
QString message;
if (pchUsage == ClangProjectSettings::PchUse_None
|| (pchUsage == ClangProjectSettings::PchUse_Custom && customPchFile.isEmpty())) {
......@@ -181,9 +181,8 @@ void PchManager::updatePchInfo(ClangProjectSettings *cps,
QTC_ASSERT(updateFunction && !message.isEmpty(), return);
Core::MessageManager::write(message, Core::MessageManager::Silent);
const UpdateParams updateParams = UpdateParams(customPchFile, projectParts);
QFuture<void> future
= QtConcurrent::run<void, const UpdateParams &>(updateFunction, updateParams);
QFuture<void> future = QtConcurrent::run(updateFunction,
UpdateParams(customPchFile, projectParts));
m_pchGenerationWatcher.setFuture(future);
Core::ProgressManager::addTask(future, tr("Precompiling..."), "Key.Tmp.Precompiling");
}
......@@ -237,7 +236,8 @@ CppTools::ProjectFile::Kind getPrefixFileKind(bool hasObjectiveC, bool hasCPlusP
}
void PchManager::doPchInfoUpdateNone(QFutureInterface<void> &future, const PchManager::UpdateParams &params)
void PchManager::doPchInfoUpdateNone(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
future.setProgressRange(0, 1);
PchInfo::Ptr emptyPch = PchInfo::createEmpty();
......@@ -246,7 +246,8 @@ void PchManager::doPchInfoUpdateNone(QFutureInterface<void> &future, const PchMa
future.setProgressValue(1);
}
void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future, const PchManager::UpdateParams &params)
void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
QHash<QString, QSet<QString> > includes, frameworks;
QHash<QString, QSet<QByteArray> > definesPerPCH;
......@@ -338,7 +339,8 @@ void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future, const PchM
future.setProgressValue(future.progressValue() + 1);
}
void PchManager::doPchInfoUpdateExact(QFutureInterface<void> &future, const PchManager::UpdateParams &params)
void PchManager::doPchInfoUpdateExact(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
future.setProgressRange(0, params.projectParts.size() + 1);
future.setProgressValue(0);
......@@ -370,7 +372,8 @@ void PchManager::doPchInfoUpdateExact(QFutureInterface<void> &future, const PchM
future.setProgressValue(future.progressValue() + 1);
}
void PchManager::doPchInfoUpdateCustom(QFutureInterface<void> &future, const PchManager::UpdateParams &params)
void PchManager::doPchInfoUpdateCustom(QFutureInterface<void> &future,
const PchManager::UpdateParams params)
{
future.setProgressRange(0, 1);
future.setProgressValue(0);
......
......@@ -85,10 +85,10 @@ private:
void updatePchInfo(ClangProjectSettings *cps,
const QList<ProjectPart::Ptr> &projectParts);
static void doPchInfoUpdateNone(QFutureInterface<void> &future, const UpdateParams &params);
static void doPchInfoUpdateFuzzy(QFutureInterface<void> &future, const UpdateParams &params);
static void doPchInfoUpdateExact(QFutureInterface<void> &future, const UpdateParams &params);
static void doPchInfoUpdateCustom(QFutureInterface<void> &future, const UpdateParams &params);
static void doPchInfoUpdateNone(QFutureInterface<void> &future, const UpdateParams params);
static void doPchInfoUpdateFuzzy(QFutureInterface<void> &future, const UpdateParams params);
static void doPchInfoUpdateExact(QFutureInterface<void> &future, const UpdateParams params);
static void doPchInfoUpdateCustom(QFutureInterface<void> &future, const UpdateParams params);
void setPCHInfo(const QList<ProjectPart::Ptr> &projectParts,
const PchInfo::Ptr &pchInfo,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment