[fixed?] MD3 remove ->crash

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
tmyke
Competition winner
Posts: 22
Joined: Thu Apr 03, 2008 4:43 pm
Location: France

[fixed?] MD3 remove ->crash

Post by tmyke »

Hello ;)

After loading a AnimatedMesh MD3 format, when I like to have a 'remove' the node, I always crash.
It's the same thing when I quit the application (device->drop() ).

There is the code I use:

Code: Select all

int main()
{
	// let user select driver type

	video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;

	printf("Please select the driver you want for this example:\n"\
		" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
		" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
		" (f) NullDevice\n (otherKey) exit\n\n");

	char i;
	std::cin >> i;

	switch(i)
	{
		case 'a': driverType = video::EDT_DIRECT3D9;break;
		case 'b': driverType = video::EDT_DIRECT3D8;break;
		case 'c': driverType = video::EDT_OPENGL;   break;
		case 'd': driverType = video::EDT_SOFTWARE; break;
		case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
		case 'f': driverType = video::EDT_NULL;     break;
		default: return 0;
	}	

	IrrlichtDevice* device = createDevice(driverType,
			core::dimension2d<s32>(640, 480), 16, false, false, false, 0);

	if (!device)
		return 1;


	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();


	IAnimatedMesh* mesh = smgr->getMesh("../../media/md3/head.md3");
	if (!mesh)		return 1;

	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
/*	if (node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
		node->setMaterialTexture( 0, driver->getTexture("../../media/md3/lower.tga") );
	}*/

	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

	while(device->run())
	{
		driver->beginScene(true, true, SColor(255,100,101,140));
		smgr->drawAll();
		driver->endScene();
	}
	device->drop();
	return 0;
}
systematic crash at the pgm exit. :?
Someone he already knows this problem ?
The release of resource of the MD3 node seems problematic...

(Irrlicht 1.5, and no problem with the MD2, for example.)


8)
Strength and wisdom.
Admin of the http://www.irrlicht.fr and dad of N3xtD.
Sorry for my poor English.
tmyke
Competition winner
Posts: 22
Joined: Thu Apr 03, 2008 4:43 pm
Location: France

Post by tmyke »

it's very strange, MD3 animations don't support the instruction 'setParent', this causes a crash too.


For the release of the ressource, it seems that the problem is located in the method 'removeChild' of ISceneNode.

Code: Select all

		virtual bool removeChild(ISceneNode* child)
		{
			core::list<ISceneNode*>::Iterator it = Children.begin();
			for (; it != Children.end(); ++it)
				if ((*it) == child)
				{
					(*it)->Parent = 0;
	---->		(*it)->drop();
					Children.erase(it);
					return true;
				}

			_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
			return false;
		}
Destructor ~CAnimatedMeshSceneNode is well call, but not that of ~IAnimatedMeshSceneNode, Still less that of ~ISceneNode.
But I have not yet found the cause of trouble.
Strength and wisdom.
Admin of the http://www.irrlicht.fr and dad of N3xtD.
Sorry for my poor English.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Confirmed and added the crash to the bug tracker. The parent problem requires further investigation.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply