Re: [Flashcoders] objects can't delete themselves right?

2007-05-25 Thread Steven Sacks
Thank you for your addition to the thread, Mark. It was quite helpful! :) Mark Winterhalder wrote: On 5/26/07, Steven Sacks <[EMAIL PROTECTED]> wrote: Correct me if I'm wrong, but I thought objects could not delete themselves, and if you delete an object with a function and store a reference

Re: [Flashcoders] objects can't delete themselves right?

2007-05-25 Thread Mark Winterhalder
On 5/26/07, Steven Sacks <[EMAIL PROTECTED]> wrote: Correct me if I'm wrong, but I thought objects could not delete themselves, and if you delete an object with a function and store a reference to that function before you delete it, that function is orphaned and will never be cleaned up by the GC

Re: [Flashcoders] objects can't delete themselves right?

2007-05-25 Thread Steven Sacks
Ok I get it now. By removing all references to the functions of class B, even though class B is telling class A to delete class B, after the delete fires and the thread is done, arguments falls out of scope, all references to class B are gone so the GC will pick it up on the next sweep. This

Re: [Flashcoders] objects can't delete themselves right?

2007-05-25 Thread Steven Sacks
Well here's my concern. I've got multiple class B that are instantiated by class A. Class A assigns a delegate of a method in class A as a listener to each class B's complete event using EventDispatcher. When class A receives the complete event from a class B, it needs to check to see if cla

Re: [Flashcoders] objects can't delete themselves right?

2007-05-25 Thread Jonathan Fung
Actually, the output makes perfect sense. The object foo was only storing a reference to the unnamed function that traces "I still exist". When you called delete on foo, you only deleted the reference and not the unnamed function. It is NOT orphaned because you previously assigned bar to the same

[Flashcoders] objects can't delete themselves right?

2007-05-25 Thread Steven Sacks
Correct me if I'm wrong, but I thought objects could not delete themselves, and if you delete an object with a function and store a reference to that function before you delete it, that function is orphaned and will never be cleaned up by the GC. Am I wrong? I have a trivial test to demonstra