[2.0]SceneManager clearScene crash some times

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
decai
Gnoblar
Posts: 4
Joined: Thu Apr 14, 2016 4:11 am

[2.0]SceneManager clearScene crash some times

Post by decai »

Hi,
I create scene nodes as below will get a crash.
1. Create 3 scene nodes node1, node2, subnodeOfNode2 sequencely. Where node1, and node2 are the sub node of rootNode, and subnodeOfNode2 is sub node of node2.
2. Delete node1 which cause the order of SceneManager::mSceneNodes to subnodeOfNode2 node2
3. Call SceneManager::clearScene() and crashed.

a. I found in Node destruct

Code: Select all

if( mParent )
        {
            Node *parent = mParent;
            mParent = 0; //We've already called mNodeMemoryManager->nodeDestroyed.
            parent->removeChild( this );
        }
and Node::removeChild

Code: Select all

assert( !child->getParent() || child->getParent() == this && "Node says it's not our child" );
So if Node::mParent is not null then the assert will false and crashed.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1280
Contact:

Re: [2.0]SceneManager clearScene crash some times

Post by dark_sylinc »

I've tried:

Code: Select all

Ogre::SceneNode *rootNode = sm->getRootSceneNode();
Ogre::SceneNode *node1 = rootNode->createChildSceneNode();
Ogre::SceneNode *node2 = rootNode->createChildSceneNode();
Ogre::SceneNode *subnodeOfNode2 = node2->createChildSceneNode();
rootNode->removeAndDestroyChild( node1 );
sm->clearScene();
Both in 2.0 and 2.1; in both Windows and Linux; and before and after creating a Camera (camera's get attached to the Root scene node so I thought it might have some effect) and I couldn't reproduce any crash / assert.

Am I missing a step?
Can you also provide a callstack?

Thanks.
Cheers
decai
Gnoblar
Posts: 4
Joined: Thu Apr 14, 2016 4:11 am

Re: [2.0]SceneManager clearScene crash some times

Post by decai »

I use sm->destroySceneNode(node1) rather than rootNode->removeAndDestroyChild( node1 ). And I'll test you code tomorrow.
Post Reply