Attn: Job Beebe Re: Hi-Jack Optimizations

And of course, if anyone else knows the answer, please answer! :slight_smile: Thanks.

I’m taking a look at your tutorial here http://jonbeebe.net/hi-jack-optimizations but it doesn’t seem to work. I put a print(“hijacking”) line in there and just commented everything else and it never prints to the terminal. Am I doing something wrong?

[lua] g.oldRemoveSelf = g.removeSelf

– Let the hi-jacking begin:
function g:removeSelf()
print(“HIJACKING”)
– call the original removeSelf() function:
–myObject:oldRemoveSelf()
–myObject = nil
end[/lua]

g is a display.newGroup()

The reason I’m doing this is because there seems to be a nasty leak in the movieclip.lua library and in order to get rid of it, I need to do some reference releasing in it’s removeSelf() function. [import]uid: 75335 topic_id: 12772 reply_id: 312772[/import]

Hmm, I think I’ve figured out why this isn’t working. I was under the impression that removeSelf() would be called recursively on all the children of the display group. It appears this is not the case. So if I use the director class, create an image and insert it into the localGroup, I can override the localGroup:removeSelf() and get the line to print, but overloading the image object removeSelf() doesn’t do anything.

Am I just completely off base to think that removeSelf() worked recursively(coulda swore I read it did), or do I need to make sure to call removeSelf() on every child object in my director group before changing scenes? [import]uid: 75335 topic_id: 12772 reply_id: 46839[/import]

Well, if anyone cares…to get this to work properly with director I had to manually call the removeSelf() functions. Maybe this is normal, but I really did think part of director’s selling point was that if you put stuff into the local group it all had removeSelf() called on it and dumped.

[import]uid: 75335 topic_id: 12772 reply_id: 46841[/import]

I *thought* that’s how Director worked, too, but I also think there was a change in cleanup from v1.2 to v1.3 – which version are you using?

Jay
[import]uid: 9440 topic_id: 12772 reply_id: 46883[/import]

I’m using 1.3 [import]uid: 75335 topic_id: 12772 reply_id: 46895[/import]