Author: max
Date: 2008-02-16 15:11:03 -0800 (Sat, 16 Feb 2008)
New Revision: 8054

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Log:
Change 20080215-maxcarlson-I by [EMAIL PROTECTED] on 2008-02-15 17:43:23 PST
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix IE memory leaks

New Features:

Bugs Fixed: LPP-5429 - IE-leak prevention leaks memory, LPP-5431 - Memory Leak 
using new and destory with <class> instances, LPP-5176 - When using IE 7: 
Repeated calls to <text>'s setText() will eventually throw javascript errors

Technical Reviewer: promanik
QA Reviewer: [EMAIL PROTECTED]
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzSprite.js - Delete entries from __sprites cache on destroy().

LzTextSprite.js - Clean up _sizedomcache when the rest of the text size cache 
is cleared.
    

Tests: Tested case from LPP-5431 and LPP-5176.tar under IE 6 windows.  No 
errors after 1000 instances, or after a page load and memory usage appears flat 
for both!



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js   2008-02-16 
15:20:13 UTC (rev 8053)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js   2008-02-16 
23:11:03 UTC (rev 8054)
@@ -1255,6 +1255,10 @@
         this.__discardElement(this.__LZcanvas);
     }
     this.__ImgPool = null;
+
+    if (this.quirks.ie_leak_prevention) {
+        delete this.__sprites[this.uid];
+    }
 }
 
 /**

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js       
2008-02-16 15:20:13 UTC (rev 8053)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js       
2008-02-16 23:11:03 UTC (rev 8054)
@@ -268,10 +268,16 @@
 
     var root = document.getElementById('lzTextSizeCache');
 
-    // Empty the cache when full, but do not reset the counter because
-    // IE holds onto the object.
     if (LzTextSprite.prototype._sizecache.counter > 0 && 
LzTextSprite.prototype._sizecache.counter % 
LzTextSprite.prototype.__sizecacheupperbound == 0) {
-        LzTextSprite.prototype._sizecache = {counter: 
LzTextSprite.prototype._sizecache.counter};
+        LzTextSprite.prototype._sizecache = {counter: 0};
+        if (LzSprite.prototype.quirks.ie_leak_prevention) {
+            var obj = LzTextSprite.prototype._sizedomcache;
+            var f = LzSprite.prototype.__discardElement;
+            for( var i in obj ) {
+                f( obj[i] );
+            }
+            LzTextSprite.prototype._sizedomcache = {}
+        }
         if (root) {
             root.innerHTML = '';
         }


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

Reply via email to