Fixed deadlock in ConfigItem::Commit().

This commit is contained in:
Gunnar Beutner 2013-03-02 14:11:12 +01:00
parent 48485c5f26
commit 4cecbfa01e
1 changed files with 4 additions and 3 deletions

View File

@ -217,11 +217,13 @@ DynamicObject::Ptr ConfigItem::Commit(void)
m_ChildObjects = children; m_ChildObjects = children;
} }
ConfigItem::Ptr self = GetSelf();
{ {
recursive_mutex::scoped_lock lock(m_Mutex); recursive_mutex::scoped_lock lock(m_Mutex);
/* Register this item. */ /* Register this item. */
m_Items[ikey] = GetSelf(); m_Items[ikey] = self;
} }
DynamicObject::Ptr dobj = GetDynamicObject(); DynamicObject::Ptr dobj = GetDynamicObject();
@ -232,8 +234,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
/* Register this item with its parents. */ /* Register this item with its parents. */
BOOST_FOREACH(const String& parentName, GetParents()) { BOOST_FOREACH(const String& parentName, GetParents()) {
ConfigItem::Ptr parent = GetObject(GetType(), parentName); ConfigItem::Ptr parent = GetObject(GetType(), parentName);
ObjectLock olock(parent); parent->RegisterChild(self);
parent->RegisterChild(GetSelf());
} }
/* Create a fake update in the format that /* Create a fake update in the format that