Bug 764742 - Thunderbird shows reference count leaks on shutdown. Clean up more objects on closing windows. Patch by florian,standard8 and bienvenu. r=florian,standard8,bienvenu,a=Standard8 for checkin to CLOSED TREE
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 14 Jun 2012 22:13:08 +0100
changeset 30822 461d927daa302b1ee09d98a7f36717aae250c732
parent 30821 4175785ae142a596f6d4bbd683eabcec8d13549c
child 30823 b2b140bfc5651cd46730f3883b5cc0bff047343f
child 30825 b1652e7557fe444e9759c14c94f94f70d53d6ce7
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, standard8, bienvenu, Standard8
bugs764742
Bug 764742 - Thunderbird shows reference count leaks on shutdown. Clean up more objects on closing windows. Patch by florian,standard8 and bienvenu. r=florian,standard8,bienvenu,a=Standard8 for checkin to CLOSED TREE
mail/base/content/mailWindow.js
mail/base/content/messageWindow.js
mail/base/modules/dbViewWrapper.js
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -75,16 +75,19 @@ function OnMailWindowUnload()
   mailSession.RemoveMsgWindow(msgWindow);
   // the tabs have the FolderDisplayWidget close their 'messenger' instances for us
 
   window.QueryInterface(Components.interfaces.nsIDOMChromeWindow)
         .browserDOMWindow = null;
 
   msgWindow.closeWindow();
 
+  msgWindow.msgHeaderSink = null;
+  msgWindow.notificationCallbacks = null;
+  gDBView = null;
   window.MsgStatusFeedback.unload();
   Components.classes["@mozilla.org/activity-manager;1"]
             .getService(Components.interfaces.nsIActivityManager)
             .removeListener(window.MsgStatusFeedback);
 }
 
 function CreateMailWindowGlobals()
 {
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -646,16 +646,20 @@ function HideMenus()
   var menuFileClose = document.getElementById('menu_close');
   var menuFileQuit = document.getElementById('menu_FileQuitItem');
   if (menuFileClose && menuFileQuit)
     menuFileQuit.parentNode.replaceChild(menuFileClose, menuFileQuit);
 }
 
 function OnUnloadMessageWindow()
 {
+  if (gFolderDisplay._magicTreeSelection) {
+    gFolderDisplay._magicTreeSelection.tree = null;
+    gFolderDisplay._magicTreeSelection = null;
+  }
   gFolderDisplay.close();
   UnloadCommandUpdateHandlers();
   // FIX ME - later we will be able to use onunload from the overlay
   OnUnloadMsgHeaderPane();
   gPhishingDetector.shutdown();
   OnMailWindowUnload();
 }
 
--- a/mail/base/modules/dbViewWrapper.js
+++ b/mail/base/modules/dbViewWrapper.js
@@ -752,16 +752,18 @@ DBViewWrapper.prototype = {
       for each (let [, folder] in Iterator(this._underlyingFolders))
         this._releaseFolderDatabase(folder);
     }
 
     // kill off the view and its search association
     if (this.dbView) {
       this.listener.onDestroyingView(false);
       this.search.dissociateView(this.dbView);
+      this.dbView.setTree(null);
+      this.dbView.selection = null;
       this.dbView.close();
       this.dbView = null;
     }
 
     // zero out the view update depth here.  We don't do it on open because it's
     //  theoretically be nice to be able to start a view update before you open
     //  something so you can defer the open.  In practice, that is not yet
     //  tested.