Added lazy setting of the UserDataContainer to avoid unncessarily create a UserDataContain when an empty description list is passed to Node::setDescriptions(..)

This commit is contained in:
Robert Osfield 2013-07-23 10:24:28 +00:00
parent 51075421d3
commit c21b60b038

View File

@ -475,7 +475,11 @@ bool Node::containsOccluderNodes() const
void Node::setDescriptions(const DescriptionList& descriptions) void Node::setDescriptions(const DescriptionList& descriptions)
{ {
getOrCreateUserDataContainer()->setDescriptions(descriptions); // only assign a description list (and associated UseDataContainer) if we need to.
if (!descriptions.empty() || getUserDataContainer())
{
getOrCreateUserDataContainer()->setDescriptions(descriptions);
}
} }
Node::DescriptionList& Node::getDescriptions() Node::DescriptionList& Node::getDescriptions()