Bug 581536 - Part 3: Disconnect the transaction manager from the pres context as soon as it's disconnected from the pres shell; r=dbaron a=blocking-betaN+
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 17 Dec 2010 20:45:18 -0800
changeset 61103 7294ab636e1d10985ac01d53ecbd1cd21e59b645
parent 61102 80df95979d3af65c8501c29d41dc86d941c5a2e4
child 61104 4cfa1d632c93ead96d4afc0742f83ce68b54bf55
push idunknown
push userunknown
push dateunknown
reviewersdbaron, blocking-betaN
bugs581536
milestone2.0b10pre
Bug 581536 - Part 3: Disconnect the transaction manager from the pres context as soon as it's disconnected from the pres shell; r=dbaron a=blocking-betaN+ This patch ensures that if for some reason, the pres context for a pres shell goes away, we do not hold on to the old transaction manager. Doing so would lead into the transition properties not being deleted from the elements, which will later on confuse the new transaction manager if we ever create one.
layout/base/nsPresContext.cpp
layout/reftests/forms/textarea-in-dynamic-rtl-doc.html
layout/reftests/forms/textarea-rtl-dynamic-attr.html
layout/reftests/forms/textarea-rtl-dynamic-style.html
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -253,20 +253,16 @@ nsPresContext::nsPresContext(nsIDocument
   mUserFontSetDirty = PR_TRUE;
 }
 
 nsPresContext::~nsPresContext()
 {
   NS_PRECONDITION(!mShell, "Presshell forgot to clear our mShell pointer");
   SetShell(nsnull);
 
-  if (mTransitionManager) {
-    mTransitionManager->Disconnect();
-  }
-
   // Disconnect the refresh driver *after* the transition manager, which
   // needs it.
   if (mRefreshDriver && mRefreshDriver->PresContext() == this) {
     mRefreshDriver->Disconnect();
   }
 
   if (mEventManager) {
     // unclear if these are needed, but can't hurt
@@ -1042,16 +1038,21 @@ nsPresContext::SetShell(nsIPresShell* aS
     // Destroy image loaders now that the presshell is going away.
     // This is important since imageloaders can have pointers to frames and
     // we don't want those pointers to outlive the destruction of the frame
     // arena.
     for (PRUint32 i = 0; i < IMAGE_LOAD_TYPE_COUNT; ++i) {
       mImageLoaders[i].Enumerate(destroy_loads, nsnull);
       mImageLoaders[i].Clear();
     }
+
+    if (mTransitionManager) {
+      mTransitionManager->Disconnect();
+      mTransitionManager = nsnull;
+    }
   }
 }
 
 void
 nsPresContext::UpdateCharSet(const nsAFlatCString& aCharSet)
 {
   if (mLangService) {
     NS_IF_RELEASE(mLanguage);