Author: max
Date: 2007-07-24 12:45:25 -0700 (Tue, 24 Jul 2007)
New Revision: 5771

Modified:
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Change 20070724-maxcarlson-G by [EMAIL PROTECTED] on 2007-07-24 11:29:20 PDT
    in /Users/maxcarlson/openlaszlo/legals-checkin/WEB-INF/lps/lfc
    for http://svn.openlaszlo.org/openlaszlo/branches/legals/WEB-INF/lps/lfc

Summary:  Fix memory leaks in IE 7

New Features:

Bugs Fixed:

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzSprite.js - More comperhensive destruction of 
non-ie_alphaimageloader images in __destroyImage().  Leave empty hashes for 
LzSprite.prototype.__sprites and LzSprite.prototype._sizedomcache in 
__cleanUpForIE().
    

Tests: Before this test, reloading any application in IE7 would show leakage 
when hitting reload repeatedly in the browser.  I tested with the task manager 
open to watch memory usage.  This change stabilizes image leaks, but there may 
still be some leaks when data is loaded.



Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-07-24 19:43:43 UTC (rev 5770)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-07-24 19:45:25 UTC (rev 5771)
@@ -978,15 +978,25 @@
   * @access private
   */
 LzSprite.prototype.__destroyImage = function (url, img) {
-    if (img && img.owner) LzUtils.callback.remove(img.owner);
+    if (img && img.owner) {
+        if (img.owner.__imgtimoutid != null) {
+            clearTimeout(img.owner.__imgtimoutid);
+            img.owner.__imgtimoutid = null;
+        }
+        LzUtils.callback.remove(img.owner);
+    }
     if (LzSprite.prototype.quirks.ie_alpha_image_loader && img.sizer) {
         if (img.sizer.tId) clearTimeout(img.sizer.tId);
         LzSprite.prototype.__discardElement(img.sizer);
+        img.sizer.onerror = null;
         img.sizer.onload = null;
         img.sizer.onloadforeal = null;
         img.sizer = null;
+    } else if (img) {
+        img.onerror = null;
+        img.onload = null
+        LzSprite.prototype.__discardElement(img);
     }
-    if (img) LzSprite.prototype.__discardElement(img);
     img = null;
     if (LzSprite.prototype.quirks.preload_images_only_once) {
         LzSprite.prototype.__preloadurls[url] = null;
@@ -1527,14 +1537,14 @@
         for (var i in obj) {
             f(obj[i]);
         }
-        LzTextSprite.prototype._sizedomcache = null;
+        LzTextSprite.prototype._sizedomcache = {};
 
         var obj = LzSprite.prototype.__sprites;
         for (var i in obj) {
             obj[i].destroy();
             obj[i] = null;
         }
-        LzSprite.prototype.__sprites = null;
+        LzSprite.prototype.__sprites = {};
 
         document.onmousemove = null;
         document.onmousedown = null;


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

Reply via email to