segfault on drawAll() after deleting a node

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
Paradigm^
Posts: 6
Joined: Tue Oct 17, 2006 2:53 pm

segfault on drawAll() after deleting a node

Post by Paradigm^ »

Hi all. I'm having a little trouble after I delete a node. I'm doing node->removeAll() and then node->remove() and it works fine, but I'm getting a segmentation fault on the next drawAll() call in my main loop - so presumably, the scene manager thinks it's still there and is trying to do something with it. Is there anything I'm missing that I need to do to tell the scene manager that this node isn't there any more?
sgt_pinky
Posts: 149
Joined: Sat Oct 14, 2006 11:20 am
Location: Melbourne, Australia

Post by sgt_pinky »

Which type scene node is it? Show us some code.

If it's created with a 'createXXX()' routine, there should be a corresponding 'drop()' somewhere - that could be one problem.
Intellectuals solve problems - geniuses prevent them. -- Einstein
#irrlicht on irc.freenode.net
Paradigm^
Posts: 6
Joined: Tue Oct 17, 2006 2:53 pm

Post by Paradigm^ »

It's an IAnimatedMeshSceneNode, created with:

Code: Select all

IAnimatedMesh* mesh = sm->getMesh("media/sydney.md2");
IAnimatedMeshSceneNode* node = sm->addAnimatedMeshSceneNode(mesh);
A pointer to it is stored in a couple of places - a map and a vector - but I've checked that those pointers go at the same time the node gets deleted. As I said, I'm deleting the node with

Code: Select all

playerIDToNode[results.at(1)]->removeAll();
playerIDToNode[results.at(1)]->remove();
playerIDToNode.erase(results.at(1));
where playerIDToNode is the map I was talking about and results.at(1) is the key in the map pointing to the node I want to remove.

I didn't want to go into the specifics as I'm 90% sure I've narrowed it down to drawAll() getting confused and trying to render it - I could paste 400+ lines of code but the most part of that isn't remotely going to be relevant. Figured it'd be more helpful to give a rundown of the problem and ask what situations might drawAll() try to render a node that isn't there?

update:/ Fixed it - I wasn't deleting the node's triangle selector from my metaSelectors.
Post Reply