gnash-dev
[Top][All Lists]
Advanced

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

[Gnash-dev] Garbage Collection question


From: Udo Giacomozzi
Subject: [Gnash-dev] Garbage Collection question
Date: Mon, 26 Nov 2007 13:31:23 +0100

The following code works fine in Gnash, but I'm wondering if the GC
deals correctly with it? The only reference to the class instance is
held by the core (setInterval), no AS variable.

Usage of the class (tested and working with Gnash):

  new Timeout(function() { trace("foo"); }, 5000);

Note the instance is *not* being assigned to a variable.

Class definition:



class Timeout {

  // === PRIVATE VARIABLEN =====================================================

  private var handle;    
  private var callback;
  private var args;
  
  // === ÖFFENTLICHE METHODEN ==================================================
  
  public function Timeout(callback, interval, args) {
    this.callback = callback;
    this.args = args;
    this.handle = setInterval(this.handler, interval, this);
  }
  
  // === PRIVATE METHODEN ======================================================
  
  private function handler(me) {
    clearInterval(me.handle);
    
    me.callback(me.args);
  }

}





reply via email to

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