Frame flattening: childframe in FrameView::layout() needs protector.
[WebKit-https.git] / Source / WebCore / page / FrameView.cpp
index f56c343d95313538669f897b9dac39953b9a43f4..d8c74b6e6938d57eda878ba2aa904c1c2a71c3cc 100644 (file)
@@ -916,6 +916,9 @@ void FrameView::layout(bool allowSubtree)
     if (m_inLayout)
         return;
 
+    // Protect the view from being deleted during layout (in recalcStyle)
+    RefPtr<FrameView> protector(this);
+
     bool inChildFrameLayoutWithFrameFlattening = isInChildFrameWithFrameFlattening();
 
     if (inChildFrameLayoutWithFrameFlattening) {
@@ -936,9 +939,6 @@ void FrameView::layout(bool allowSubtree)
     m_delayedLayout = false;
     m_setNeedsLayoutWasDeferred = false;
 
-    // Protect the view from being deleted during layout (in recalcStyle)
-    RefPtr<FrameView> protector(this);
-
     if (!m_frame) {
         // FIXME: Do we need to set m_size.width here?
         // FIXME: Should we set m_size.height here too?