This change is fairly low-risk, and it will make life in IE much more
livable. Please integrate it to 4.4!
--
Regards,
Max Carlson
OpenLaszlo.org
--- Begin Message ---
Author: max
Date: 2009-05-23 12:42:35 -0700 (Sat, 23 May 2009)
New Revision: 13996
Modified:
openlaszlo/trunk/lps/components/extensions/drawview.lzx
Log:
Change 20090523-maxcarlson-l by maxcarl...@bank on 2009-05-23 12:30:54 PDT
in /Users/maxcarlson/openlaszlo/trunk-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: UPDATED: Fix IE memory leaks in drawview
Bugs Fixed: LPP-7939 - Huge memory leak in IE7 on each reload of the app
Technical Reviewer: [email protected]
QA Reviewer: mdemmon
Details: Tucker fund an updated memory leak checker that pinpointed a couple of
properties in drawview (one in excanvas) that were causing apps to leak.
Implemented destroy() to clean up after the canvas, added instance to
LzSprite.prototype.__sprites hash so IE cleans up onbeforeunload - see
LzSprite.js for more. Test to be sure __LZcanvas exists before touching it,
delete self from __sprites so destroy isn't called twice.
Tests: test/extensions/drawing.lzx?lzr=dhtml&lzt=html (and webtop) show no
leaks with the leak detector from M$, found at
http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx
Modified: openlaszlo/trunk/lps/components/extensions/drawview.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/drawview.lzx 2009-05-23
19:34:04 UTC (rev 13995)
+++ openlaszlo/trunk/lps/components/extensions/drawview.lzx 2009-05-23
19:42:35 UTC (rev 13996)
@@ -591,11 +591,27 @@
this._hidden = false;
this.maxTries = 10;
this.__initie();
+ // add to list of 'sprites' so we are cleaned up
+ LzSprite.prototype.__sprites[this.sprite.uid + 'canvas'] =
this;
} else {
this.setAttribute('context',
this.__LZcanvas.getContext("2d"));
}
}
+ override function destroy() {
+ if (lz.embed.browser.isIE) {
+ if (this.__LZcanvas) {
+ //
http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx complains
about these properties
+ this.__LZcanvas.owner = null;
+ this.__LZcanvas.getContext = null;
+ var lzsp = LzSprite.prototype;
+ lzsp.__discardElement(this.__LZcanvas);
+ delete lzsp.__sprites[this.sprite.uid + 'canvas'];
+ }
+ }
+ super.destroy();
+ }
+
override function $lzc$set_width(w) {
super.$lzc$set_width(w);
w = Math.floor(w);
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
--- End Message ---