Author: ptw
Date: 2007-12-16 14:27:13 -0800 (Sun, 16 Dec 2007)
New Revision: 7557
Modified:
openlaszlo/branches/4.0.5.2/
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/svg/LzSprite.js
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/services/LzIdle.lzs
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/views/LaszloView.lzs
openlaszlo/branches/4.0.5.2/lps/components/debugger/newcontent.lzx
openlaszlo/branches/4.0.5.2/lps/components/debugger/scrollingtext.lzx
Log:
Change 20071216-ptw-3 by [EMAIL PROTECTED] on 2007-12-16 10:49:44 EST
in /Users/ptw/OpenLaszlo/4.0.5.2
for http://svn.openlaszlo.org/openlaszlo/branches/4.0.5.2
Summary: Fix Sprite memory Leaks
Bugs Fixed:
LPP-5217 'windows can leak memory
Technical Reviewer: [EMAIL PROTECTED] (pending)
QA Reviewer: [EMAIL PROTECTED] (pending)
Details:
Merged revisions 7518 via svnmerge from
http://svn.openlaszlo.org/openlaszlo/trunk
Tests:
Test case from bug report. Before: many leaked LzSprite objects,
after: none.
Property changes on: openlaszlo/branches/4.0.5.2
___________________________________________________________________
Name: svnmerge-integrated
-
/openlaszlo/branches/legals:1-5746,5748-5756,5758-5770,5772-5819,5821-5860,5862-5890,5892-6065,6068-6177,6179-6228,6230-6236,6241-6266
/openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334,7413,7418,7420,7422-7425,7427-7430,7432-7436,7438-7439,7441,7443,7446-7448
+
/openlaszlo/branches/legals:1-5746,5748-5756,5758-5770,5772-5819,5821-5860,5862-5890,5892-6065,6068-6177,6179-6228,6230-6236,6241-6266
/openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334,7413,7418,7420,7422-7425,7427-7430,7432-7436,7438-7439,7441,7443,7446-7448,7518
Modified: openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/core/LzNode.lzs 2007-12-16
22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/core/LzNode.lzs 2007-12-16
22:27:13 UTC (rev 7557)
@@ -1252,7 +1252,7 @@
* @access private
*/
function __LZresolveRefs ( refs ){
- //need to resolve init= before constraints...
+ // $once are applied before $always
for ( var p in refs ){
var rp = refs[ p ];
var pp;
@@ -1277,18 +1277,17 @@
}
}
this.dataBindAttribute( p , pp );
- } else if ( !('dependencies' in rp && rp.dependencies) ){
- if (rp instanceof Function) {
- rp.call(this);
- }
+ } else if ((rp instanceof Function) &&
+ // A function with no or null dependencies is a $once
+ (! ('dependencies' in rp && rp.dependencies))) {
+ rp.call(this);
}
}
- // Now resolve the $always values
+ // Functions with dependencies are $always
for ( var p in refs ){
- // The string check prevents a dhtml error
var rp = refs[ p ];
- if (rp instanceof Function && ('dependencies' in rp)) {
+ if ((rp instanceof Function) && ('dependencies' in rp)) {
this.applyConstraint( p , rp , rp.dependencies.call(this) );
}
}
@@ -1744,7 +1743,7 @@
if (this.__LZdeleted == true) {
return;
}
-
+ // To keep delegates from resurrecting us. See LzDelegate#execute
this.__LZdeleted = true;
if (this.ondestroy.ready) this.ondestroy.sendEvent( this );
Modified:
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
2007-12-16 22:27:13 UTC (rev 7557)
@@ -566,7 +566,6 @@
* @access private
*/
function destroyClone ( v ) {
- v.sprite.destroy(true);
v.destroy();
}
Modified:
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
---
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
2007-12-16 22:25:41 UTC (rev 7556)
+++
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
2007-12-16 22:27:13 UTC (rev 7557)
@@ -200,7 +200,7 @@
}
LzInputTextSprite.prototype.__textEvent = function ( e, eventname ){
- if (this.destroyed == true) return;
+ if (this.__LZdeleted == true) return;
var keycode = e ? e.keyCode : event.keyCode;
if (eventname == 'onfocus' || eventname == 'onmousedown') {
LzInputTextSprite.prototype.__focusedSprite = this;
Modified: openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
2007-12-16 22:27:13 UTC (rev 7557)
@@ -1095,16 +1095,22 @@
LzSprite.prototype.predestroy = function() {
}
-LzSprite.prototype.destroy = function(recursive) {
- if (this.destroyed == true) return;
- //alert('destroy' + this + ', recursive ' + recursive);
- if (recursive) {
- if (this.__children) {
- for (var i = 0; i < this.__children.length; i++) {
- this.__children[i].destroy(recursive);
- }
+LzSprite.prototype.destroy = function() {
+ if (this.__LZdeleted == true) return;
+ // To keep delegates from resurrecting us. See LzDelegate#execute
+ this.__LZdeleted = true;
+
+ // Remove from parent if the parent is not going to be GC-ed
+ if (! this.__parent.__LZdeleted) {
+ var pc = this.__parent.__children;
+ for (var i = pc.length - 1; i >= 0; i--) {
+ if (pc[i] === this) {
+ pc.splice(i, 1);
+ break;
}
+ }
}
+
if (this.__ImgPool) this.__ImgPool.destroy();
if (this.__LZimg) this.__discardElement(this.__LZimg);
if (this.__LZclick) {
@@ -1134,7 +1140,6 @@
this.__discardElement(this.__LZcanvas);
}
this.__ImgPool = null;
- this.destroyed = true;
}
/**
Modified: openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/svg/LzSprite.js
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/svg/LzSprite.js
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/svg/LzSprite.js
2007-12-16 22:27:13 UTC (rev 7557)
@@ -471,7 +471,7 @@
}
}
-LzSprite.prototype.destroy = function(recursive) {
+LzSprite.prototype.destroy = function() {
}
LzSprite.prototype.getMouse = function(xy) {
Modified:
openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
2007-12-16 22:27:13 UTC (rev 7557)
@@ -255,7 +255,7 @@
/**
* @access private
*/
-LzMakeLoadSprite.destroy = function (recur) {
+LzMakeLoadSprite.destroy = function () {
if ('updateDel' in this)
this.updateDel.unregisterAll();
if ('errorDel' in this)
@@ -266,5 +266,5 @@
this.loader.unload( this.loader.mc );
// call shadowed destroy()
- this.___destroy( recur );
+ this.___destroy();
}
Modified: openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
2007-12-16 22:27:13 UTC (rev 7557)
@@ -888,18 +888,16 @@
* @access private
*
*/
-LzSprite.prototype.destroy = function(recursive){
- if (recursive) {
- if (this.owner.subviews) {
- for (var i = 0; i < this.owner.subviews.length; i++) {
- this.owner.subviews[i].sprite.destroy(recursive);
- }
- }
- }
+LzSprite.prototype.destroy = function(){
+ if (this.__LZdeleted == true) return;
+ // To keep delegates from resurrecting us. See LzDelegate#execute
+ this.__LZdeleted = true;
+
if (this.updatePlayDel) {
this.updatePlayDel.unregisterAll();
delete this.updatePlayDel;
}
+
if (this.doQueuedDel) {
this.doQueuedDel.unregisterAll();
delete this.doQueuedDel;
Modified: openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/services/LzIdle.lzs
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/services/LzIdle.lzs
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/services/LzIdle.lzs
2007-12-16 22:27:13 UTC (rev 7557)
@@ -34,12 +34,14 @@
*/
class LzIdleClass {
-var coi = [];
+ var coi;
var removeCOI = null;
function initialize () {
-this.removeCOI = new LzDelegate( this , "removeCallIdleDelegates" );
+ // Create array on instance, not prototype
+ this.coi = new Array;
+ this.removeCOI = new LzDelegate( this , "removeCallIdleDelegates" );
}
Modified: openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/views/LaszloView.lzs
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/WEB-INF/lps/lfc/views/LaszloView.lzs
2007-12-16 22:27:13 UTC (rev 7557)
@@ -1032,10 +1032,10 @@
super.destroy.apply(this, arguments);
+ if (this.sprite) { this.sprite.destroy() }
+
if ( recursiveCall == true ) { return; }
- if (this.sprite) { this.sprite.destroy(recursiveCall) }
-
//this.__LZFinishDestroyOnIdle();
this.setVisibility ( "hidden" );
Modified: openlaszlo/branches/4.0.5.2/lps/components/debugger/newcontent.lzx
===================================================================
--- openlaszlo/branches/4.0.5.2/lps/components/debugger/newcontent.lzx
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/lps/components/debugger/newcontent.lzx
2007-12-16 22:27:13 UTC (rev 7557)
@@ -3,7 +3,7 @@
**************************************************************************-->
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2004, 2007 Laszlo Systems, Inc. All Rights Reserved.
*
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
@@ -281,7 +281,7 @@
<view name="lower_right_corner" bgcolor="#888888" width="11" height="11"
x="${parent.width-11}" y="${parent.height-11}"/>
- <_dbg_horiz_scrollbar id="dhsb" y="${classroot.textpane.height}"
+ <_dbg_horiz_scrollbar name="dhsb" y="${classroot.textpane.height}"
width="${parent.width - 11}"
bgcolor="#666666" height="13" />
Modified: openlaszlo/branches/4.0.5.2/lps/components/debugger/scrollingtext.lzx
===================================================================
--- openlaszlo/branches/4.0.5.2/lps/components/debugger/scrollingtext.lzx
2007-12-16 22:25:41 UTC (rev 7556)
+++ openlaszlo/branches/4.0.5.2/lps/components/debugger/scrollingtext.lzx
2007-12-16 22:27:13 UTC (rev 7557)
@@ -281,7 +281,7 @@
<view name="lower_right_corner" bgcolor="#888888" width="11" height="11"
x="${parent.width-11}" y="${parent.height-11}"/>
- <_dbg_horiz_scrollbar id="dhsb" y="${parent.content.height-2}"
+ <_dbg_horiz_scrollbar name="dhsb" y="${parent.content.height-2}"
width="${parent.width - 11}"
bgcolor="#666666" height="13" />
@@ -421,7 +421,7 @@
</class>
</library>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2004,2007 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!-- @LZX_VERSION@ -->
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins