simgear/props/props.cxx: fixed bug in SGPropertyNode::removeChild().
Don't set node->_parent to null before calling SGPropertyNodeImpl::fireChildRemoved(). This fixes problem with Jaguar-GR1 HUD. [Should probably set node->_parent to null before returning, but previous (non-locked) code didn't do this, and it would require acquiring mutex.
This commit is contained in:
parent
f74ba148ab
commit
c9051cedca
@ -2621,11 +2621,6 @@ bool SGPropertyNode::removeChild(SGPropertyNode* node)
|
|||||||
SGPropertyLockExclusive exclusive(*this);
|
SGPropertyLockExclusive exclusive(*this);
|
||||||
SGPropertyLockExclusive exclusive_node(*node);
|
SGPropertyLockExclusive exclusive_node(*node);
|
||||||
|
|
||||||
/*SGSharedPtr<SGPropertyNode> p = node->_parent.lock();
|
|
||||||
if (p != this) {
|
|
||||||
assert(0);
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
if (node->_parent != this) {
|
if (node->_parent != this) {
|
||||||
assert(0);
|
assert(0);
|
||||||
return false;
|
return false;
|
||||||
@ -2637,8 +2632,6 @@ bool SGPropertyNode::removeChild(SGPropertyNode* node)
|
|||||||
}
|
}
|
||||||
SGPropertyNodeImpl::setAttribute(exclusive_node, *node, REMOVED, true);
|
SGPropertyNodeImpl::setAttribute(exclusive_node, *node, REMOVED, true);
|
||||||
SGPropertyNodeImpl::clearValue(exclusive_node, *node);
|
SGPropertyNodeImpl::clearValue(exclusive_node, *node);
|
||||||
node->_parent = nullptr;
|
|
||||||
|
|
||||||
exclusive_node.release();
|
exclusive_node.release();
|
||||||
SGPropertyNodeImpl::fireChildRemoved(exclusive, *this, this /*parent*/, node);
|
SGPropertyNodeImpl::fireChildRemoved(exclusive, *this, this /*parent*/, node);
|
||||||
|
|
||||||
@ -2646,6 +2639,9 @@ bool SGPropertyNode::removeChild(SGPropertyNode* node)
|
|||||||
// released our exclusive lock.
|
// released our exclusive lock.
|
||||||
it = std::find(_children.begin(), _children.end(), node);
|
it = std::find(_children.begin(), _children.end(), node);
|
||||||
_children.erase(it);
|
_children.erase(it);
|
||||||
|
|
||||||
|
// fixme: should probably set node->_parent to null here. this was not done
|
||||||
|
// in previous (non-locking) props code.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user