Related to bug 23761: Fixed leaks in Recent Views menu when a window is opened
authorAugusto Mauch <augusto.mauch@openbravo.com>
Fri, 10 May 2013 09:27:29 +0200
changeset 20309 58ca94d1bf65
parent 20308 752359630143
child 20310 590cb3340e9a
Related to bug 23761: Fixed leaks in Recent Views menu when a window is opened
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Fri May 10 08:58:48 2013 +0200
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Fri May 10 09:27:29 2013 +0200
@@ -436,7 +436,7 @@
 
   setRecentList: function (layout) {
     var recentList, newRecent, handleClickFunction, recentIndex = 0,
-        recent, lbl, newIcon, entryLayout, icon;
+        recent, lbl, newIcon, entryLayout, icon, destroyFunction;
 
     // start with a fresh content
     layout.destroyAndRemoveMembers(layout.members);
@@ -453,6 +453,11 @@
         }
       };
 
+      destroyFunction = function () {
+        this.destroyAndRemoveMembers(this.members);
+        this.Super('destroy', arguments);
+      };
+
       for (; recentIndex < recentList.length; recentIndex++) {
         if (recentList[recentIndex]) {
           recent = recentList[recentIndex];
@@ -492,7 +497,8 @@
 
           entryLayout = isc.HLayout.create({
             defaultLayoutAlign: 'center',
-            width: '100%'
+            width: '100%',
+            destroy: destroyFunction
           });
           entryLayout.addMember(lbl);
           // if a standard window then show the new icon