REGRESSION r119802: Remove unnecessary ASSERT(!m_deletionHasBegun) from Document.h
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2012 09:19:39 +0000 (09:19 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2012 09:19:39 +0000 (09:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88528

Reviewed by Ryosuke Niwa.

m_deletionHasBegun should become true just before 'delete this'.

No tests. No change in behavior.

* dom/Document.h:
(WebCore::Document::guardRef):
(WebCore::Document::guardDeref):

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

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Node.h
Source/WebCore/platform/TreeShared.h
Source/WebCore/svg/SVGElementInstance.h

index 2fee2a4..8ae369e 100644 (file)
@@ -1,3 +1,18 @@
+2012-06-08  Kentaro Hara  <haraken@chromium.org>
+
+        REGRESSION r119802: Remove unnecessary ASSERT(!m_deletionHasBegun) from Document.h
+        https://bugs.webkit.org/show_bug.cgi?id=88528
+
+        Reviewed by Ryosuke Niwa.
+
+        m_deletionHasBegun should become true just before 'delete this'.
+
+        No tests. No change in behavior.
+
+        * dom/Document.h:
+        (WebCore::Document::guardRef):
+        (WebCore::Document::guardDeref):
+
 2012-06-08  Adam Barth  <abarth@webkit.org>
 
         HTTP 204 No Content responses shouldn't trigger MIME type warnings in the web inspector
index 12928c0..4228d63 100644 (file)
@@ -641,6 +641,7 @@ Document::~Document()
 
 void Document::removedLastRef()
 {
+    ASSERT(!m_deletionHasBegun);
     if (m_guardRefCount) {
         // If removing a child removes the last self-only ref, we don't
         // want the scope to be destructed until after
@@ -685,6 +686,9 @@ void Document::removedLastRef()
 
         guardDeref();
     } else {
+#ifndef NDEBUG 
+        m_deletionHasBegun = true; 
+#endif 
         delete this;
     }
 }
index 29effe3..e3c7ade 100644 (file)
@@ -146,7 +146,13 @@ public:
     static StyleChange diff(const RenderStyle*, const RenderStyle*, Document*);
 
     virtual ~Node();
-    virtual void removedLastRef() { delete this; }
+    virtual void removedLastRef()
+    {
+#ifndef NDEBUG
+        m_deletionHasBegun = true;
+#endif
+        delete this;
+    }
 
     // DOM methods & attributes for Node
 
index 7a91ced..971a7e3 100644 (file)
@@ -89,7 +89,6 @@ public:
         if (--m_refCount <= 0 && !m_parent) {
 #ifndef NDEBUG
             m_inRemovedLastRefFunction = true;
-            m_deletionHasBegun = true;
 #endif
             callRemovedLastRef(this);
         }
index df14209..e4cc519 100644 (file)
@@ -47,7 +47,13 @@ public:
     }
 
     virtual ~SVGElementInstance();
-    virtual void removedLastRef() { delete this; };
+    virtual void removedLastRef()
+    {
+#ifndef NDEBUG
+        m_deletionHasBegun = true;
+#endif
+        delete this;
+    };
 
     void setParentOrHostNode(SVGElementInstance* instance) { setParent(instance); }