Commit 63378648 authored by Eike Ziller's avatar Eike Ziller Committed by Erik Verbruggen

VariableManager: Hopefully fix crash with int variables

Capturing const references in lambdas is potentially dangerous.

Change-Id: I4b4ddc8dcb1e839e4ed919caccdf0010ed8e6a34
Task-number: QTCREATORBUG-12948
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 9e62375b
......@@ -253,8 +253,9 @@ void VariableManager::registerVariable(const QByteArray &variable,
void VariableManager::registerIntVariable(const QByteArray &variable,
const QString &description, const VariableManager::IntFunction &value)
{
const VariableManager::IntFunction valuecopy = value; // do not capture a reference in a lambda
registerVariable(variable, description,
[value]() { return QString::number(value ? value() : 0); });
[valuecopy]() { return QString::number(valuecopy ? valuecopy() : 0); });
}
/*!
......
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