Add assert verifying all renderers get destroyed
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 18:52:08 +0000 (18:52 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 18:52:08 +0000 (18:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177870

Reviewed by Zalan Bujtas.

* rendering/RenderView.cpp:
(WebCore::RenderView::willBeDestroyed):

    Add assert to verify all renderers for this tree have been destroyed before the RenderView is.

* rendering/RenderView.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222863 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h

index fda353d..1868525 100644 (file)
@@ -1,3 +1,17 @@
+2017-10-04  Antti Koivisto  <antti@apple.com>
+
+        Add assert verifying all renderers get destroyed
+        https://bugs.webkit.org/show_bug.cgi?id=177870
+
+        Reviewed by Zalan Bujtas.
+
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::willBeDestroyed):
+
+            Add assert to verify all renderers for this tree have been destroyed before the RenderView is.
+
+        * rendering/RenderView.h:
+
 2017-10-04  Daniel Bates  <dabates@apple.com>
 
         TextDecorationPainter::m_wavyOffset should be a float
index 6fcb599..fd1be9c 100644 (file)
@@ -641,6 +641,13 @@ bool RenderView::isScrollableOrRubberbandableBox() const
     return frameView().isScrollable(defineScrollable);
 }
 
+void RenderView::willBeDestroyed()
+{
+    RenderBlockFlow::willBeDestroyed();
+
+    ASSERT_WITH_MESSAGE(m_rendererCount == 1, "All other renderers in this render tree should have be destroyed");
+}
+
 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
 {
     rects.append(snappedIntRect(accumulatedOffset, layer()->size()));
index 82d13d6..960ab56 100644 (file)
@@ -286,6 +286,8 @@ private:
 
     bool isScrollableOrRubberbandableBox() const override;
 
+    void willBeDestroyed() override;
+
 private:
     FrameView& m_frameView;