I got a question about the implementation of object deletion.
if a object has children they will not be deleted using orxObject_Delete, but rather their lifetime will be set to zero.
what's the reason for that?
the reason I'm asking is that I'm deleting a object that has children which are disabled. setting their lifetime to zero will result in a memory "leak". (it's not really a leak because memory is used only once, but it never freed either, because the lifetime check is below the check if a object is enabled in the game loop)
Nice to see you around.
A few months ago, Laschweinski asked the same thing here: https://forum.orx-project.org/discussion/2185&catid=12#2185
I made a change to delete children immediately but that turned out to have side effects. So in the end, the children are still getting deleted during the next update but they are forced to be active (change list #2605).
You should probably use a fresher version from svn as there has been a bunch of fixes over the past few months.
ok then will also enable the objects before setting the life time to zero.
just out of curiosity, what sort of side effects occurred, when deleting the children directly?
yeah I'm using a couple of months old version and I should update that at some point. on the other hand: never touch a running system
For the side effects, the biggest (that I can remember) was when using a SetLifeTime(0) on a parent object, we'd then immediately delete its children while traversing the collection of objects during the next "tick". And of course, removing items while traversing the collection resulted in dangling pointers in the traversal code.
As for the old version, that's wisdom speaking. However only been fixes have been added over the past few months, no new features.