Fixes issue 18227: Destroy status bar icons when destroying the bar
authorIván Perdomo <ivan.perdomo@openbravo.com>
Tue, 23 Aug 2011 18:26:05 +0200
changeset 13583 4bd475992f92
parent 13582 0cf02944934f
child 13584 cc1bbe5d1b98
Fixes issue 18227: Destroy status bar icons when destroying the bar
- The are 3 icons (images) that needs to be explicitly destroyed when
destroying a statusbar object
- Small code-style fixes
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js	Tue Aug 23 14:27:58 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js	Tue Aug 23 18:26:05 2011 +0200
@@ -170,7 +170,7 @@
       height : '100%'
     });
 
-    this.leftStatusBar = isc.OBStatusBarLeftBar.create( {});
+    this.leftStatusBar = isc.OBStatusBarLeftBar.create({});
     this.leftStatusBar.addMember(this.contentLabel);
     
     this.buttonBar = isc.OBStatusBarIconButtonBar.create(this.buttonBarProperties);
@@ -179,12 +179,12 @@
     this.savedIcon = isc.Img.create(this.savedIconDefaults);
     this.newIcon = isc.Img.create(this.newIconDefaults);
     this.editIcon = isc.Img.create(this.editIconDefaults);
-    this.spacer = isc.LayoutSpacer.create( {
+    this.spacer = isc.LayoutSpacer.create({
       width : 14
     });
     this.leftStatusBar.addMember(this.spacer, 0);
 
-    this.addMembers( [ this.leftStatusBar, this.buttonBar ]);
+    this.addMembers([this.leftStatusBar, this.buttonBar]);
     this.Super('initWidget', arguments);
   },
   
@@ -374,6 +374,23 @@
       return '&nbsp;&nbsp;&nbsp;';
     }
     return value;
+  },
+
+  destroy: function () {
+    if(this.savedIcon) {
+      this.savedIcon.destroy();
+      this.savedIcon = null;
+    }
+
+    if(this.newIcon) {
+      this.newIcon.destroy();
+      this.newIcon = null;
+    }
+
+    if(this.editIcon) {
+      this.editIcon.destroy();
+      this.editIcon = null;
+    }
+    this.Super('destroy', arguments);
   }
-
 });