mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #13488 from hyperlogic/bug-fix/qstring-from-script-engine
Fix for heap-corruption in Settings::saveAll due to implicitly shared QStrings
This commit is contained in:
commit
b07d317f4c
1 changed files with 4 additions and 1 deletions
|
@ -35,5 +35,8 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVar
|
|||
}
|
||||
|
||||
void SettingsScriptingInterface::setValue(const QString& setting, const QVariant& value) {
|
||||
Setting::Handle<QVariant>(setting).set(value);
|
||||
// Make a deep-copy of the string.
|
||||
// Dangling pointers can occur with QStrings that are implicitly shared from a QScriptEngine.
|
||||
QString deepCopy = QString::fromUtf16(setting.utf16());
|
||||
Setting::Handle<QVariant>(deepCopy).set(value);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue