You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/10/05 01:34:49 UTC
svn commit: r582052 - in /incubator/xap/trunk/codebase/src:
dojo/src/event/browser.js dojo/src/widget/Manager.js
xap/widgets/Checkbox.js xap/widgets/RadioButton.js
Author: jmargaris
Date: Thu Oct 4 18:34:47 2007
New Revision: 582052
URL: http://svn.apache.org/viewvc?rev=582052&view=rev
Log:
memory leak fixes for radio closures and for
widget manager
Modified:
incubator/xap/trunk/codebase/src/dojo/src/event/browser.js
incubator/xap/trunk/codebase/src/dojo/src/widget/Manager.js
incubator/xap/trunk/codebase/src/xap/widgets/Checkbox.js
incubator/xap/trunk/codebase/src/xap/widgets/RadioButton.js
Modified: incubator/xap/trunk/codebase/src/dojo/src/event/browser.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/dojo/src/event/browser.js?rev=582052&r1=582051&r2=582052&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/dojo/src/event/browser.js (original)
+++ incubator/xap/trunk/codebase/src/dojo/src/event/browser.js Thu Oct 4 18:34:47 2007
@@ -78,8 +78,13 @@
}
}
+ try{ window.onbeforeunload = null; }catch(e){}
try{ window.onload = null; }catch(e){}
try{ window.onunload = null; }catch(e){}
+
+ try{ delete(window.onbeforeunload) }catch(e){}
+ try{ delete(window.onunload) }catch(e){}
+ try{ delete(window.onload) }catch(e){}
dojo._ie_clobber.clobberNodes = [];
// CollectGarbage();
});
Modified: incubator/xap/trunk/codebase/src/dojo/src/widget/Manager.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/dojo/src/widget/Manager.js?rev=582052&r1=582051&r2=582052&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/dojo/src/widget/Manager.js (original)
+++ incubator/xap/trunk/codebase/src/dojo/src/widget/Manager.js Thu Oct 4 18:34:47 2007
@@ -63,9 +63,14 @@
this.destroyAll = function(){
for(var x=this.widgets.length-1; x>=0; x--){
- try{
- // this.widgets[x].destroyChildren();
- this.widgets[x].destroy(true);
+ try{
+ var widget = widgets[x];
+ if (widget.uninitialize){
+ widget.uninitialize();
+ }
+ if (widget.destroyRendering){
+ widget.destroyRendering(true);
+ }
delete this.widgets[x];
}catch(e){ }
}
Modified: incubator/xap/trunk/codebase/src/xap/widgets/Checkbox.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/Checkbox.js?rev=582052&r1=582051&r2=582052&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/Checkbox.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/Checkbox.js Thu Oct 4 18:34:47 2007
@@ -34,4 +34,7 @@
this.img.srcOFFDisabled = appContext + "src/xap/widgets/images/checkbox_off_disabled.gif";
this.setOff();
+
+ dojo.event.connect(this.img,'onclick',this, "onStateChange");
+ dojo.event.connect(this.span,'onclick',this, "onStateChange");
}
Modified: incubator/xap/trunk/codebase/src/xap/widgets/RadioButton.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/RadioButton.js?rev=582052&r1=582051&r2=582052&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/RadioButton.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/RadioButton.js Thu Oct 4 18:34:47 2007
@@ -30,13 +30,6 @@
this.setAlignVertical("center");
this.setAlignHorizontal("left");
- this.img.onclick = function() {
- this.clickobj && this.clickobj[this.clickfn] && this.clickobj[this.clickfn](this.clickparam);
- }
- this.span.onclick = function() {
- this.clickobj && this.clickobj[this.clickfn] && this.clickobj[this.clickfn](this.clickparam);
- }
-
this.selected = false;
this.imgSelectedURL = "";
this.imgPressedSelectedURL = "";
@@ -45,23 +38,28 @@
Xap.setupClassAsSubclassOf("xap.widgets.RadioButton", "xap.widgets.Button");
+
+xap.widgets.RadioButton.prototype.onStateChange = function() {
+ this.clickobj && this.clickobj[this.clickfn] && this.clickobj[this.clickfn](this.clickparam);
+}
+
+
xap.widgets.RadioButton.prototype.init = function(appContext) {
this.img.srcON = appContext + "src/xap/widgets/images/radio_on.gif";
this.img.srcOFF = appContext + "src/xap/widgets/images/radio_off.gif";
this.img.srcONDisabled = appContext + "src/xap/widgets/images/radio_on_disabled.gif";
this.img.srcOFFDisabled = appContext + "src/xap/widgets/images/radio_off_disabled.gif";
+ dojo.event.connect(this.img,'onclick',this, "onStateChange");
+ dojo.event.connect(this.span,'onclick',this, "onStateChange");
+
this.setOff();
}
xap.widgets.RadioButton.prototype.setOnClick = function(obj, fn, param) {
- this.img.clickobj = obj;
- this.img.clickfn = fn;
- this.img.clickparam = param;
-
- this.span.clickobj = obj;
- this.span.clickfn = fn;
- this.span.clickparam = param;
+ this.clickobj = obj;
+ this.clickfn = fn;
+ this.clickparam = param;
}
xap.widgets.RadioButton.prototype.setOn = function() {