[fixed]CAnimatedMeshSceneNode::removeChild() bug

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

[fixed]CAnimatedMeshSceneNode::removeChild() bug

Post by ssexton »

In my app, I add an animation scene node as a child of my mesh (CAnimatedMeshSceneNode) representing a spell effect. In 1.3.1, I could call removeChild using the sfx node id and it would remove the effect. In 1.4, it isn't getting removed.

I've traced the problem to CAnimatedMeshSceneNode::removeChild(). The problem is that, for me, JointsUsed == false, because I never call any of the methods that cause checkJoints() to be called. Here's the relevant code excerpted from CAnimatedMeshSceneNode.cpp:

Code: Select all

	if (JointsUsed) //stop it doing weird things while the joints are being made
	{
		if (ISceneNode::removeChild(child))
		{
			for (u32 i=0; i<JointChildSceneNodes.size(); ++i)
			if (JointChildSceneNodes[i] == child)
			{
				//JointChildSceneNodes[i]->drop();
				JointChildSceneNodes[i] = 0;
				return true;
			}

			return true;
		}
	}
As this code is all new in 1.4, I'm not sure if there is a new method call I'm supposed to be making that causes JointsUsed to get set. It seems to happen in checkJoints(). But I don't understand why I should have to call any of the joint methods if I'm not using joint nodes, just in order to get removeChild to work? It looks like a bug to me, like its trying to guard against a race between removeChild being called while joint nodes are getting demand-created (the comment says as much), but problem is, I think it needs to use a different guard variable to do it.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, I guess Luke will know why he made it like this and how it's fixed.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Great bug report, by the way.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

good find ssexton, that's a pretty bad bug, I cannot believe it was missed for so long. fixing it now
Post Reply