CAnimatedMeshSceneNode.cpp clone memory issues [FIXED]

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
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

CAnimatedMeshSceneNode.cpp clone memory issues [FIXED]

Post by luthyr »

It seems that CAnimatedMeshSceneNode::clone() may have some issues with reference counts and grabbing. At least, when I have been cloning meshes with animation callbacks, they get prematurely deleted and cause crashes.

Should

Code: Select all

newNode->LoopCallBack = LoopCallBack;
newNode->PassCount = PassCount;
newNode->Shadow = Shadow;
newNode->Shadow->grab();
be

Code: Select all

newNode->LoopCallBack = LoopCallBack;
if (newNode->LoopCallBack)
   newNode->LoopCallBack->grab();
newNode->PassCount = PassCount;
newNode->Shadow = Shadow;
if (newNode->Shadow)
   newNode->Shadow->grab();
?

EDIT: Sorry, typo.
Last edited by luthyr on Thu Jun 13, 2013 10:28 am, edited 1 time in total.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: CAnimatedMeshSceneNode.cpp clone memory issues

Post by CuteAlien »

Thanks for your report - your changes seem to be correct. Well... second check should only be "if (newNode->Shadow)", but I guess that was a typo.

Not sure yet if I'll be able to be back to Irrlicht programming before next release, so I hope someone else in the team can add it (to 1.8 branch I guess).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: CAnimatedMeshSceneNode.cpp clone memory issues

Post by Nadro »

As I remember it's already fixed in v1.8.1 branch, if not I'll apply this patch today.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: CAnimatedMeshSceneNode.cpp clone memory issues

Post by CuteAlien »

I thought the same at first :-) But seems we fixed some other clone problems - but not this one yet.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: CAnimatedMeshSceneNode.cpp clone memory issues

Post by Nadro »

OK, so as I said before I'll fix it today in v1.8.1 branch ;)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: CAnimatedMeshSceneNode.cpp clone memory issues

Post by Nadro »

Fixed.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply