Deleting a SceneNode crashes Program

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
terrorchrist
Posts: 83
Joined: Wed Apr 26, 2006 10:07 pm
Location: Vienna

Deleting a SceneNode crashes Program

Post by terrorchrist »

I've got a problem in deleting my SceneNodes!!!

Code: Select all

void _cdecl NewtonManager::PhysicsBodyDestructor (const NewtonBody* body)
	{
		MeshContainer *container;
		// get the graphic object form the rigid body
		container = (MeshContainer*) NewtonBodyGetUserData (body);
		// destroy the graphic object
		//container->node->removeAll();
		//container->node->drop();
		//destroy the newton body
		NewtonDestroyBody(NewtonBodyGetWorld( container->body ), container->body); //program terminates
		// call the scene manager to delete the mesh
		extern ISceneManager *smgrGlobal;
		smgrGlobal->addToDeletionQueue(container->node);
		
	};
if I use container->node->removeAll(); the program crashes ("cannot access adress...")
if I use container->node->drop(); the program crashes too ("cannot access address...")

so what am I doing wrong?!
could you PLEASE help me?
Ced666
Posts: 86
Joined: Fri Jan 13, 2006 10:29 am
Location: Belgium

Post by Ced666 »

Don't do that:

Code: Select all

smgrGlobal->addToDeletionQueue(container->node); 
Just use the remove (or removeAll) function from your node.
Post Reply