Commit 6c46d604 authored by darin@apple.com's avatar darin@apple.com

2008-06-14 Darin Adler <darin@apple.com>

        Reviewed by Sam.

        - fix https://bugs.webkit.org/show_bug.cgi?id=19544
          DashboardRegion pieces are leaking

        My recent change introduced a leak of objects owned by each DashboardRegion,
        because I made ~Rect non-virtual. By using a separate RefCounted class for
        each of Rect and DashboardRegion, the leak is gone. It's not clear if the
        DashboardRegion class should really exist -- it doesn't have a DOM binding,
        so it could conceivably be removed some day.

        * css/DashboardRegion.h: Derive from RectBase instead of from Rect.
        * css/Rect.h: Added RectBase. Changed Rect to derive from RectBase.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3aa89278
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix https://bugs.webkit.org/show_bug.cgi?id=19544
DashboardRegion pieces are leaking
My recent change introduced a leak of objects owned by each DashboardRegion,
because I made ~Rect non-virtual. By using a separate RefCounted class for
each of Rect and DashboardRegion, the leak is gone. It's not clear if the
DashboardRegion class should really exist -- it doesn't have a DOM binding,
so it could conceivably be removed some day.
* css/DashboardRegion.h: Derive from RectBase instead of from Rect.
* css/Rect.h: Added RectBase. Changed Rect to derive from RectBase.
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
* Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
* Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -27,7 +27,7 @@
namespace WebCore {
class DashboardRegion : public Rect {
class DashboardRegion : public RectBase, public RefCounted<DashboardRegion> {
public:
static PassRefPtr<DashboardRegion> create() { return adoptRef(new DashboardRegion); }
......
......@@ -26,10 +26,8 @@
namespace WebCore {
class Rect : public RefCounted<Rect> {
class RectBase {
public:
static RefPtr<Rect> create() { return adoptRef(new Rect); }
CSSPrimitiveValue* top() const { return m_top.get(); }
CSSPrimitiveValue* right() const { return m_right.get(); }
CSSPrimitiveValue* bottom() const { return m_bottom.get(); }
......@@ -41,7 +39,8 @@ namespace WebCore {
void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; }
protected:
Rect() { }
RectBase() { }
~RectBase() { }
private:
RefPtr<CSSPrimitiveValue> m_top;
......@@ -50,6 +49,14 @@ namespace WebCore {
RefPtr<CSSPrimitiveValue> m_left;
};
class Rect : public RectBase, public RefCounted<Rect> {
public:
static PassRefPtr<Rect> create() { return adoptRef(new Rect); }
private:
Rect() { }
};
} // namespace WebCore
#endif // Rect_h
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment