Title: [129323] trunk/Source/WebCore
Revision
129323
Author
[email protected]
Date
2012-09-23 20:33:57 -0700 (Sun, 23 Sep 2012)

Log Message

REGRESSION(r128239): Mutable ElementAttributeData leak their Attribute vectors.
<http://webkit.org/b/97423>

Reviewed by Anders Carlsson.

r128239 added a WTF::deleteOwnedPtr() override for ElementAttributeData*, but ElementAttributeData is
a ref-counted object. Fixed this by overriding deref() instead to call the appropriate subclass destructor.

* dom/ElementAttributeData.h:
(WebCore::ElementAttributeData::deref):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129322 => 129323)


--- trunk/Source/WebCore/ChangeLog	2012-09-24 03:28:08 UTC (rev 129322)
+++ trunk/Source/WebCore/ChangeLog	2012-09-24 03:33:57 UTC (rev 129323)
@@ -1,3 +1,16 @@
+2012-09-23  Andreas Kling  <[email protected]>
+
+        REGRESSION(r128239): Mutable ElementAttributeData leak their Attribute vectors.
+        <http://webkit.org/b/97423>
+
+        Reviewed by Anders Carlsson.
+
+        r128239 added a WTF::deleteOwnedPtr() override for ElementAttributeData*, but ElementAttributeData is
+        a ref-counted object. Fixed this by overriding deref() instead to call the appropriate subclass destructor.
+
+        * dom/ElementAttributeData.h:
+        (WebCore::ElementAttributeData::deref):
+
 2012-09-23  Byungwoo Lee  <[email protected]>
 
         Fix build warnings : -Wunused-parameter, -Wparentheses, -Wuninitialized.

Modified: trunk/Source/WebCore/dom/ElementAttributeData.h (129322 => 129323)


--- trunk/Source/WebCore/dom/ElementAttributeData.h	2012-09-24 03:28:08 UTC (rev 129322)
+++ trunk/Source/WebCore/dom/ElementAttributeData.h	2012-09-24 03:33:57 UTC (rev 129323)
@@ -46,6 +46,10 @@
     static PassRefPtr<ElementAttributeData> create();
     static PassRefPtr<ElementAttributeData> createImmutable(const Vector<Attribute>&);
 
+    // Override RefCounted's deref() to ensure operator delete is called on
+    // the appropriate subclass type.
+    void deref();
+
     void clearClass() { m_classNames.clear(); }
     void setClass(const AtomicString& className, bool shouldFoldCase) const { m_classNames.set(className, shouldFoldCase); }
     const SpaceSplitString& classNames() const { return m_classNames; }
@@ -256,18 +260,15 @@
     return &mutableAttributeVector().at(index);
 }
 
-}
-
-namespace WTF {
-
-template <> inline void deleteOwnedPtr<WebCore::ElementAttributeData>(WebCore::ElementAttributeData* ptr)
+inline void ElementAttributeData::deref()
 {
-    if (!ptr)
+    if (!derefBase())
         return;
-    if (ptr->isMutable())
-        delete static_cast<WebCore::MutableElementAttributeData*>(ptr);
+
+    if (m_isMutable)
+        delete static_cast<MutableElementAttributeData*>(this);
     else
-        delete static_cast<WebCore::ImmutableElementAttributeData*>(ptr);
+        delete static_cast<ImmutableElementAttributeData*>(this);
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to