Bug 610545, add cycle collection to TransitionEnder to prevent leak, r=smaug
authorNeil Deakin <neil@mozilla.com>
Tue, 08 Apr 2014 08:45:52 -0400
changeset 177561 96fe808574232416a57b24cc635bcec908dbc929
parent 177560 127895063bb0df411b40c0b431403b56f7628c68
child 177562 0f1702d62ee107fce5642c05897d4179ca5f0f0a
push id26556
push userryanvm@gmail.com
push dateTue, 08 Apr 2014 22:16:57 +0000
treeherdermozilla-central@5811efc11011 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs610545
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 610545, add cycle collection to TransitionEnder to prevent leak, r=smaug
layout/xul/nsXULPopupManager.cpp
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -932,17 +932,18 @@ nsXULPopupManager::HidePopup(nsIContent*
 // This is used to hide the popup after a transition finishes.
 class TransitionEnder : public nsIDOMEventListener
 {
 public:
 
   nsCOMPtr<nsIContent> mContent;
   bool mDeselectMenu;
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_CLASS(TransitionEnder)
 
   TransitionEnder(nsIContent* aContent, bool aDeselectMenu)
     : mContent(aContent), mDeselectMenu(aDeselectMenu)
   {
   }
 
   virtual ~TransitionEnder() { }
 
@@ -960,17 +961,24 @@ public:
       pm->HidePopupCallback(mContent, popupFrame, nullptr, nullptr,
                             popupFrame->PopupType(), mDeselectMenu);
     }
 
     return NS_OK;
   }
 };
 
-NS_IMPL_ISUPPORTS1(TransitionEnder, nsIDOMEventListener)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(TransitionEnder)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(TransitionEnder)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TransitionEnder)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_CYCLE_COLLECTION_1(TransitionEnder, mContent);
 
 void
 nsXULPopupManager::HidePopupCallback(nsIContent* aPopup,
                                      nsMenuPopupFrame* aPopupFrame,
                                      nsIContent* aNextPopup,
                                      nsIContent* aLastPopup,
                                      nsPopupType aPopupType,
                                      bool aDeselectMenu)