Allow modifying the name attribute

fixes #8033
This commit is contained in:
Gunnar Beutner 2014-12-09 20:37:20 +01:00
parent 8b8bed6744
commit 291b000e09
1 changed files with 13 additions and 5 deletions

View File

@ -177,24 +177,32 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)
if (discard)
m_Expression.reset();
String name = m_Name;
String item_name;
String short_name = dobj->GetShortName();
if (!short_name.IsEmpty()) {
item_name = short_name;
dobj->SetName(short_name);
} else
item_name = m_Name;
String name = item_name;
NameComposer *nc = dynamic_cast<NameComposer *>(type.get());
if (nc) {
name = nc->MakeName(m_Name, dobj);
name = nc->MakeName(name, dobj);
if (name.IsEmpty())
BOOST_THROW_EXCEPTION(std::runtime_error("Could not determine name for object"));
}
if (name != m_Name)
dobj->SetShortName(m_Name);
if (name != item_name)
dobj->SetShortName(item_name);
dobj->SetName(name);
dobj->OnConfigLoaded();
{
boost::mutex::scoped_lock lock(m_Mutex);
m_CommittedItems.push_back(this);