Settings: Fix crash on exit due to group double-free
parent
49117de476
commit
e7f33ee2f1
|
@ -824,13 +824,21 @@ bool Settings::setDefault(const std::string &name, const std::string &value)
|
||||||
|
|
||||||
bool Settings::setGroup(const std::string &name, Settings *group)
|
bool Settings::setGroup(const std::string &name, Settings *group)
|
||||||
{
|
{
|
||||||
return setEntry(name, &group, true, false);
|
// Settings must own the group pointer
|
||||||
|
// avoid double-free by copying the source
|
||||||
|
Settings *copy = new Settings();
|
||||||
|
*copy = *group;
|
||||||
|
return setEntry(name, ©, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Settings::setGroupDefault(const std::string &name, Settings *group)
|
bool Settings::setGroupDefault(const std::string &name, Settings *group)
|
||||||
{
|
{
|
||||||
return setEntry(name, &group, true, true);
|
// Settings must own the group pointer
|
||||||
|
// avoid double-free by copying the source
|
||||||
|
Settings *copy = new Settings();
|
||||||
|
*copy = *group;
|
||||||
|
return setEntry(name, ©, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue