Bug 494283. Unregister our placeholder if someone forgot to. r=dbaron
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 03 Aug 2009 10:42:57 -0400
changeset 31045 c3f21caf76f87ef509a48b0173b8e46e3d85ffba
parent 31044 cae5076351fa530c387207c19861510636396ac7
child 31046 4ea13f32b79065f3259e0509868de32d323b4a0c
push id8351
push userbzbarsky@mozilla.com
push dateMon, 03 Aug 2009 14:43:33 +0000
treeherdermozilla-central@4ea13f32b790 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs494283
milestone1.9.2a1pre
Bug 494283. Unregister our placeholder if someone forgot to. r=dbaron
layout/generic/nsPlaceholderFrame.cpp
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -122,19 +122,23 @@ nsPlaceholderFrame::Reflow(nsPresContext
   return NS_OK;
 }
 
 void
 nsPlaceholderFrame::Destroy()
 {
   nsIPresShell* shell = PresContext()->GetPresShell();
   if (shell && mOutOfFlowFrame) {
-    NS_ASSERTION(!shell->FrameManager()->GetPlaceholderFrameFor(mOutOfFlowFrame),
-                 "Placeholder relationship should have been torn down; see "
-                 "comments in nsPlaceholderFrame.h");
+    if (shell->FrameManager()->GetPlaceholderFrameFor(mOutOfFlowFrame)) {
+      NS_ERROR("Placeholder relationship should have been torn down; see "
+               "comments in nsPlaceholderFrame.h.  Unregistering ourselves, "
+               "but this might cause our out-of-flow to be unable to destroy "
+               "itself properly.  Not that it could anyway, with us dead.");
+      shell->FrameManager()->UnregisterPlaceholderFrame(this);
+    }
   }
 
   nsSplittableFrame::Destroy();
 }
 
 nsSplittableType
 nsPlaceholderFrame::GetSplittableType() const
 {