On Tue, Jul 10, 2007 at 11:07:00AM +0800, zou lunkai wrote:
> The above testcase does something like this:
>
> obj = new Object();
> obj.onKeyDown = function () { };
> Key.addListener(obj);
> delete obj;
>
> The observed behavious is:
> After deleting 'obj', the onKeyDown event handler could still be
> invoked. So I think the created object is still alive, but without an
> explicit reference.
>
> I'd like to know how GC would deal with this. Knowing this would
> help me find a general solution to fix bug #20317.
Ok. Currently we do NOT keep key listeners alive, assuming they'd
deregister themselves on destruction. Since you're reporting this
is NOT the case, the movie_root::markReachableResources (or the
Key::markReachableResources
in case it relies on the existance of the global Key object) must
be changed to keep listeners alive (mark them as reachable).
See also: http://www.gnashdev.org/wiki/index.php/MemoryManagement#Listeners
Just wondering: does it mean that in the above case the user
has NO way to release the resources associated with that object ?
--strk;