Bugfix: Crash while reloading config

Fixes #3621
This commit is contained in:
Gunnar Beutner 2013-02-03 15:47:11 +01:00
parent ba49fd38e1
commit b997462eef

View File

@ -188,8 +188,12 @@ DynamicObject::Ptr ConfigItem::Commit(void)
parent->RegisterChild(GetSelf());
}
/* We need to make a copy of the child objects becauuse the
* OnParentCommitted() handler is going to update the list. */
set<ConfigItem::WeakPtr> children = m_ChildObjects;
/* notify our children of the update */
BOOST_FOREACH(const ConfigItem::WeakPtr wchild, m_ChildObjects) {
BOOST_FOREACH(const ConfigItem::WeakPtr wchild, children) {
const ConfigItem::Ptr& child = wchild.lock();
if (!child)
@ -240,6 +244,8 @@ void ConfigItem::UnregisterFromParents(void)
{
BOOST_FOREACH(const String& parentName, m_Parents) {
ConfigItem::Ptr parent = GetObject(GetType(), parentName);
if (parent)
parent->UnregisterChild(GetSelf());
}
}