Related to issue 18227: Closing a tab doesn't release all objects
authorMartin Taal <martin.taal@openbravo.com>
Wed, 28 Sep 2011 07:33:21 +0200
changeset 13849 f2a4f4808579
parent 13848 9705f4af28aa
child 13850 04194ede4e76
Related to issue 18227: Closing a tab doesn't release all objects
MiniDateRangeItem needs specific code as it is not a daterangeitem but a TextItem
Other mem leak remaining, will revisit for MP5
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js	Wed Sep 28 07:06:25 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js	Wed Sep 28 07:33:21 2011 +0200
@@ -442,6 +442,28 @@
     }
     return true;
   },
+   
+  // Explicit destroy of the rangedialog as formitems don't have 
+  // an auto delete of autochilds
+  destroy: function() {
+    this.destroying = true;
+    if (this.rangeDialog) {
+      this.rangeDialog.rangeForm.destroy();
+      this.rangeDialog.mainLayout.destroy();
+      this.rangeDialog.destroying  = true;
+      this.rangeDialog.destroy();
+      this.rangeDialog.destroying  = false;
+    }
+    this.Super('destroy', arguments);
+    this.destroying = false;
+  },
+  
+  clear: function() {
+    if (this.destroying) {
+      return;
+    }
+    this.Super('clear', arguments);
+  },
   
   formatDate: function(dt) {
     return OB.Utilities.Date.JSToOB(dt, OB.Format.date);