canvas::Element: fix cleanup (and hopefully crash)
This commit is contained in:
parent
9868fb03a2
commit
6200b160ec
@ -202,6 +202,13 @@ namespace canvas
|
||||
{
|
||||
parent->removeChild(_transform.get());
|
||||
}
|
||||
|
||||
// Hide in case someone still holds a reference
|
||||
setVisible(false);
|
||||
removeListener();
|
||||
|
||||
_parent = 0;
|
||||
_transform = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -39,7 +39,8 @@ namespace simgear
|
||||
//----------------------------------------------------------------------------
|
||||
void PropertyBasedElement::removeListener()
|
||||
{
|
||||
_node->removeChangeListener(this);
|
||||
if( _node )
|
||||
_node->removeChangeListener(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user