Bug 1438470 - Backed out changeset bbb96e5f8fa8 for being incorrect. nsITreeBoxObject::SetView() was restored in bug 1438512. a=jorgk
authorJorg K <jorgk@jorgk.com>
Fri, 16 Feb 2018 10:56:41 +0100
changeset 31116 d0777339c5c9bca2665e288b484e6c504e134e24
parent 31115 961aa136630db53e2f0371e445b5f05e554a573a
child 31117 806edd95c5d9ceae05b16748a4784a8d149fda0c
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersjorgk
bugs1438470, 1438512
Bug 1438470 - Backed out changeset bbb96e5f8fa8 for being incorrect. nsITreeBoxObject::SetView() was restored in bug 1438512. a=jorgk
mailnews/addrbook/src/nsAbView.cpp
--- a/mailnews/addrbook/src/nsAbView.cpp
+++ b/mailnews/addrbook/src/nsAbView.cpp
@@ -54,16 +54,18 @@ nsAbView::~nsAbView()
     NS_ASSERTION(NS_SUCCEEDED(ClearView()), "failed to close view");
   }
 }
 
 NS_IMETHODIMP nsAbView::ClearView()
 {
   mDirectory = nullptr;
   mAbViewListener = nullptr;
+  if (mTree)
+    mTree->SetView(nullptr);
   mTree = nullptr;
   mTreeSelection = nullptr;
 
   if (mInitialized)
   {
     nsresult rv;
     mInitialized = false;
     nsCOMPtr<nsIPrefBranch> pbi(do_GetService(NS_PREFSERVICE_CONTRACTID,
@@ -164,16 +166,17 @@ NS_IMETHODIMP nsAbView::SetView(nsIAbDir
   // Ensure we are initialized
   nsresult rv = Initialize();
 
   mAbViewListener = nullptr;
   if (mTree)
   {
     // Try and speed deletion of old cards by disconnecting the tree from us.
     mTreeSelection->ClearSelection();
+    mTree->SetView(nullptr);
   }
 
   // Clear out old cards
   int32_t i = mCards.Length();
   while(i-- > 0)
   {
     rv = RemoveCardAt(i);
     NS_ASSERTION(NS_SUCCEEDED(rv), "remove card failed\n");