Commit 3e71c118 authored by darin's avatar darin
Browse files

Reviewed by Adele.

        - fixed a couple of storage leaks noticed by the buildbot

        * html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::attach):
        Call deref on the style after calling setRenderStyle, since styleForRenderer
        returns us a "ref'd" RenderStyle object.
        * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::attach): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 22a690e4
2006-07-07 Darin Adler <darin@apple.com>
Reviewed by Adele.
- fixed a couple of storage leaks noticed by the buildbot
* html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::attach):
Call deref on the style after calling setRenderStyle, since styleForRenderer
returns us a "ref'd" RenderStyle object.
* html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::attach): Ditto.
2006-07-07 Darin Adler <darin@apple.com>
Reviewed by Adele.
......
......@@ -28,10 +28,10 @@
#include "HTMLOptGroupElement.h"
#include "Document.h"
#include "cssstyleselector.h"
#include "HTMLSelectElement.h"
#include "HTMLNames.h"
#include "HTMLSelectElement.h"
#include "RenderMenuList.h"
#include "cssstyleselector.h"
namespace WebCore {
......@@ -126,7 +126,9 @@ bool HTMLOptGroupElement::checkDTD(const Node* newChild)
void HTMLOptGroupElement::attach()
{
setRenderStyle(styleForRenderer(0));
RenderStyle* style = styleForRenderer(0);
setRenderStyle(style);
style->deref(document()->renderArena());
HTMLGenericFormElement::attach();
}
......@@ -139,13 +141,12 @@ void HTMLOptGroupElement::detach()
HTMLGenericFormElement::detach();
}
void HTMLOptGroupElement::setRenderStyle( RenderStyle* newStyle )
void HTMLOptGroupElement::setRenderStyle(RenderStyle* newStyle)
{
RenderStyle* oldStyle = m_style;
m_style = newStyle;
if (m_style)
m_style->ref();
if (newStyle)
newStyle->ref();
if (oldStyle)
oldStyle->deref(document()->renderArena());
}
......
......@@ -28,12 +28,12 @@
#include "HTMLOptionElement.h"
#include "Document.h"
#include "cssstyleselector.h"
#include "ExceptionCode.h"
#include "HTMLNames.h"
#include "HTMLSelectElement.h"
#include "RenderMenuList.h"
#include "Text.h"
#include "cssstyleselector.h"
#include <wtf/Vector.h>
namespace WebCore {
......@@ -54,7 +54,9 @@ bool HTMLOptionElement::checkDTD(const Node* newChild)
void HTMLOptionElement::attach()
{
setRenderStyle(styleForRenderer(0));
RenderStyle* style = styleForRenderer(0);
setRenderStyle(style);
style->deref(document()->renderArena());
HTMLGenericFormElement::attach();
}
......@@ -210,13 +212,12 @@ void HTMLOptionElement::setLabel(const String& value)
setAttribute(labelAttr, value);
}
void HTMLOptionElement::setRenderStyle( RenderStyle* newStyle )
void HTMLOptionElement::setRenderStyle(RenderStyle* newStyle)
{
RenderStyle* oldStyle = m_style;
m_style = newStyle;
if (m_style)
m_style->ref();
if (newStyle)
newStyle->ref();
if (oldStyle)
oldStyle->deref(document()->renderArena());
}
......
Supports Markdown
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