Related to issue 18227: Closing a tab doesn't release all objects
authorMartin Taal <martin.taal@openbravo.com>
Thu, 01 Sep 2011 12:32:58 +0200
changeset 13645 b21bbf743e3f
parent 13644 ddf08e2b22d9
child 13646 14d243b5df4a
Related to issue 18227: Closing a tab doesn't release all objects
Destroy of removed tab pane was already implemented in super, making use of its implementation
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-tab.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-tab.js	Thu Sep 01 12:00:38 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-tab.js	Thu Sep 01 12:32:58 2011 +0200
@@ -287,14 +287,15 @@
   },
 
   updateTab: function (tab, pane) {
-    var previousPane = tab && pane && tab.pane;
+    var previousPane = tab && this.getTabObject(tab).pane;
+    
+    this.Super('updateTab', arguments);
+
     // Note: updateTab doesn't remove the previous loading tab
     // http://www.smartclient.com/docs/8.1/a/b/c/go.html#method..TabSet.updateTab
     if(previousPane) {
       previousPane.destroy();
-      previousPane = null;
     }
-    this.Super('updateTab', arguments);
   }
 });
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js	Thu Sep 01 12:00:38 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js	Thu Sep 01 12:32:58 2011 +0200
@@ -286,15 +286,7 @@
               // is used to prevent history updating
               loadingPane.isLoadingTab = true;
 
-              // refresh the existing tab
-              // explicitly destroy as the old tab is not destroyed
-              if (tabSet.getTabObject(viewTabId)) {
-                currentPane = tabSet.getTabObject(viewTabId).pane;  
-              }
               tabSet.updateTab(viewTabId, loadingPane);
-              if (currentPane) {
-                currentPane.destroy();
-              }
               
               // and show it
               tabSet.selectTab(viewTabId);
@@ -344,15 +336,7 @@
 
             // refresh the view
 
-            // refresh the existing tab
-            // explicitly destroy as the old tab is not destroyed
-            if (tabSet.getTabObject(viewTabId)) {
-              currentPane = tabSet.getTabObject(viewTabId).pane;  
-            }
             tabSet.updateTab(viewTabId, viewInstance);
-            if (currentPane) {
-              currentPane.destroy();
-            }
 
             // and show it
             tabSet.selectTab(viewTabId);