Fixed memory corruption when using a node as a key

This commit is contained in:
Jesse Beder
2014-08-16 10:52:51 -05:00
parent 1aa25e7679
commit 2c340f0546
2 changed files with 13 additions and 0 deletions

View File

@@ -380,6 +380,7 @@ inline const Node Node::operator[](const Node& key) const {
throw InvalidNode();
EnsureNodeExists();
key.EnsureNodeExists();
m_pMemory->merge(*key.m_pMemory);
detail::node& value =
static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
return Node(value, m_pMemory);
@@ -390,6 +391,7 @@ inline Node Node::operator[](const Node& key) {
throw InvalidNode();
EnsureNodeExists();
key.EnsureNodeExists();
m_pMemory->merge(*key.m_pMemory);
detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
return Node(value, m_pMemory);
}