2008-03-27 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Mar 2008 05:25:33 +0000 (05:25 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Mar 2008 05:25:33 +0000 (05:25 +0000)
        Reviewed by Darin.

        - fixed many buildbot leaks in glyph map code

        * svg/SVGGlyphMap.h:
        (WebCore::GlyphMapNode::create): Use explicit create pattern, to avoid overreffing and therefore leaking
        these objects.
        (WebCore::SVGGlyphMap::add): Call create instead of using new.

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

WebCore/ChangeLog
WebCore/svg/SVGGlyphMap.h

index 1aa7e29de6941aea4a5b2b600055e9b943152420..f8dceaf98699901119a6de0d83c68091bb0b836a 100644 (file)
@@ -1,3 +1,14 @@
+2008-03-27  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+
+        - fixed many buildbot leaks in glyph map code
+
+        * svg/SVGGlyphMap.h:
+        (WebCore::GlyphMapNode::create): Use explicit create pattern, to avoid overreffing and therefore leaking
+        these objects.
+        (WebCore::SVGGlyphMap::add): Call create instead of using new.
+
 2008-03-27  Maciej Stachowiak  <mjs@apple.com>
 
         Rubber stamped by Oliver.
index 97f2e181a395591ca92063156c00d2aaa6a805f0..2f49a678e9cb8d0e88f59d78309165dea3af1cd7 100644 (file)
@@ -31,7 +31,10 @@ namespace WebCore {
     typedef HashMap<UChar, RefPtr<GlyphMapNode> > GlyphMapLayer;
 
     struct GlyphMapNode : public RefCounted<GlyphMapNode> {
+    private:
         GlyphMapNode() { }
+    public:
+        PassRefPtr<GlyphMapNode> create() { return adoptRef(new GlyphMapNode); }
 
         Vector<SVGGlyphIdentifier> glyphs;
 
@@ -39,6 +42,7 @@ namespace WebCore {
     };
 
     class SVGGlyphMap {
+
     public:
         SVGGlyphMap() : m_currentPriority(0) { }
 
@@ -52,7 +56,7 @@ namespace WebCore {
                 UChar curChar = string[i];
                 node = currentLayer->get(curChar);
                 if (!node) {
-                    node = new GlyphMapNode;
+                    node = GlyphMapNode::create();
                     currentLayer->set(curChar, node);
                 }
                 currentLayer = &node->children;