gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/key_eve...


From: zou lunkai
Subject: Re: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/key_eve...
Date: Tue, 10 Jul 2007 11:38:45 +0800

> Just wondering: does it mean that in the above case the user
> has NO way to release the resources associated with that object ?

Ah, I think I found a way to access that object now.

Test:

obj = new Object();
obj.x = 1;
obj.onKeyDown = function ()  {  _root.objRef = this };
Key.addListener(obj);
delete obj;

Observed behaviour:

after deleting obj,  if no key has been pressed, then _root.objRef is undefined;
if any key has been pressed, then we could get a new reference
'objRef', and both
objRef and objRef.x are defined.


On 7/10/07, zou lunkai <address@hidden> wrote:
> Just wondering: does it mean that in the above case the user
> has NO way to release the resources associated with that object ?

I guess so.

Test1:

 obj = new Object();
 obj.onKeyDown = function ()  { };
 Key.addListener(obj);
 Key.removeListener(obj);
 delete obj;

everything has been deleted as expected.


Test2:

 obj = new Object();
 obj.onKeyDown = function ()  { };
 Key.addListener(obj);
 delete obj;   // onKeyDown could be invoked after this, 'obj' is undefined
 Key.removeListener(obj); // has not effect,  onKeyDown could still be
invoked after this.



On 7/10/07, Sandro Santilli <address@hidden> wrote:
> 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;
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]