CanvasGroup: Do not try to remove already removed children.

This commit is contained in:
Thomas Geymayer
2013-06-14 19:47:09 +02:00
parent 86e2de8d10
commit e27b6d050c
2 changed files with 13 additions and 0 deletions

View File

@@ -209,6 +209,9 @@ namespace canvas
//----------------------------------------------------------------------------
bool Element::accept(EventVisitor& visitor)
{
if( !_transform.valid() )
return false;
return visitor.apply(*this);
}
@@ -314,6 +317,9 @@ namespace canvas
{
if( parent == _node && child->getNameString() == NAME_TRANSFORM )
{
if( !_transform.valid() )
return;
if( child->getIndex() >= static_cast<int>(_transform_types.size()) )
{
SG_LOG

View File

@@ -263,6 +263,11 @@ namespace canvas
if( getChildFactory(node->getNameString()) )
{
if( !_transform.valid() )
// If transform is destroyed also all children are destroyed, so we can
// not do anything here.
return;
ElementPtr child = getChild(node);
if( !child )
SG_LOG
@@ -348,8 +353,10 @@ namespace canvas
//----------------------------------------------------------------------------
ElementPtr Group::getChildByIndex(size_t index) const
{
assert(_transform.valid());
OSGUserData* ud =
static_cast<OSGUserData*>(_transform->getChild(index)->getUserData());
assert(ud);
return ud->element;
}