Author: bargull
Date: 2008-02-02 05:27:43 -0800 (Sat, 02 Feb 2008)
New Revision: 7947

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTimer.lzs
Log:
Change 20080126-bargull-6 by [EMAIL PROTECTED] on 2008-01-26 16:43:10
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Use delegate-id to identify delegate in LzTimer

New Features:

Bugs Fixed: LPP-5379 - "LzTimer never stops calling delegate if called object's 
toString() value changes"

Technical Reviewer: ptw
QA Reviewer: pbr
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
As described by the bug-reporter, if the return-value of the context's 
"toString"-method changed, the delegate won't be removed from LzTimer. This 
happens because a delegate itself is used as the key for the LzTimer's 
"timerList", or better the string-representation of the delegate -> which is 
the return value of the delegate's "toString"-method. But the "toString"-method 
also depends on the context's "toString"-method. And I guess I don't need to 
underline that this may cause several errors for components like <text>...
However, to fix this bug, the delegates are now identified by their delegate-id 
in the "timerList".


Tests:
see bugreport



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTimer.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTimer.lzs       2008-02-01 
20:42:44 UTC (rev 7946)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTimer.lzs       2008-02-02 
13:27:43 UTC (rev 7947)
@@ -1,6 +1,6 @@
 /**
   *
-  * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @affects lztimer
@@ -92,11 +92,11 @@
             Debug.error("setInterval result type is unexpected; LzTimer will 
fail");
     }
     p.id = id;
-    var tle = this.timerList[d];
+    var tle = this.timerList[d.__delegateID];
     if (tle == null) {
-        this.timerList[d] = id;
+        this.timerList[d.__delegateID] = id;
     } else if (! (tle instanceof Array)) {
-        this.timerList[d] = [tle, id];
+        this.timerList[d.__delegateID] = [tle, id];
     } else {
         tle.push(id);
     }
@@ -110,18 +110,18 @@
   * order received.
   */
 function removeTimer ( d ){
-    var tle = this.timerList[d];
+    var tle = this.timerList[d.__delegateID];
     var id = null;
     if (tle != null) {
         if (tle instanceof Array) {
             id = tle.shift();
             clearInterval(id);
             if (tle.length == 0)
-                delete this.timerList[d];
+                delete this.timerList[d.__delegateID];
         } else {
             id = tle;
             clearInterval(id);
-            delete this.timerList[d];
+            delete this.timerList[d.__delegateID];
         }
         // Debug.format("cleared timer %w for delegate %w (2)\n", id, d);
     }
@@ -137,7 +137,7 @@
   * @access private
   */
 function removeTimerWithID ( d, id ){
-    var tle = this.timerList[d];
+    var tle = this.timerList[d.__delegateID];
     if (tle != null) {
         if (tle instanceof Array) {
             var i = 0;
@@ -150,10 +150,10 @@
                 }
             }
             if (tle.length == 0)
-                delete this.timerList[d];
+                delete this.timerList[d.__delegateID];
         } else if (tle == id) {
             clearInterval(id);
-            delete this.timerList[d];
+            delete this.timerList[d.__delegateID];
         }
     }
 }
@@ -175,7 +175,7 @@
 
 if ($debug) {
   function countTimers ( d ){
-    var tle = this.timerList[d];
+    var tle = this.timerList[d.__delegateID];
     if (tle == null)
         return 0;
     else if (tle instanceof Array)


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to