From: Gunnar Beutner Date: Tue, 25 Aug 2015 15:19:59 +0000 (+0200) Subject: Clean up the code a bit X-Git-Tag: v2.4.0~375 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=827125a69a978d0307a7b20e5c935f8fba71988b;p=icinga2 Clean up the code a bit refs #9096 --- diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index f8c4d573a..c1b3f6cd9 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -328,8 +328,7 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector& ne boost::mutex::scoped_lock lock(m_Mutex); BOOST_FOREACH(const TypeMap::value_type& kv, m_Items) { - BOOST_FOREACH(const ItemMap::value_type& kv2, kv.second) - { + BOOST_FOREACH(const ItemMap::value_type& kv2, kv.second) { if (!kv2.second->m_Abstract && !kv2.second->m_Object) items.push_back(std::make_pair(kv2.second, false)); } @@ -403,6 +402,8 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector& ne continue; BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) { + ASSERT(item->m_Object); + if (item->m_Type == type) upq.Enqueue(boost::bind(&ConfigObject::OnAllConfigLoaded, item->m_Object)); } @@ -416,6 +417,8 @@ bool ConfigItem::CommitNewItems(WorkQueue& upq, std::vector& ne BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) { BOOST_FOREACH(const ConfigItem::Ptr& item, new_items) { + ASSERT(item->m_Object); + if (item->m_Type == loadDep) upq.Enqueue(boost::bind(&ConfigObject::CreateChildObjects, item->m_Object, ptype)); }