Commit 1f68bf4a authored by ggaren@apple.com's avatar ggaren@apple.com

Fixed https://bugs.webkit.org/show_bug.cgi?id=29941

REGRESSION (r48882-r48888): Many memory leaks on SnowLeopard leaks bot

Patch by Geoffrey Garen <ggaren@apple.com> on 2009-09-30
Reviewed by Mark Rowe.

Forgot to implement a destructor for JSDOMWindowBaseData, so it was
leaking its RefPtr data member.

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::destroyJSDOMWindowBaseData):
* bindings/js/JSDOMWindowBase.h:
(WebCore::JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData::JSDOMWindowBaseData):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 44194bce
2009-09-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Mark Rowe.
Fixed https://bugs.webkit.org/show_bug.cgi?id=29941
REGRESSION (r48882-r48888): Many memory leaks on SnowLeopard leaks bot
Forgot to implement a destructor for JSDOMWindowBaseData, so it was
leaking its RefPtr data member.
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::destroyJSDOMWindowBaseData):
* bindings/js/JSDOMWindowBase.h:
(WebCore::JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData::JSDOMWindowBaseData):
2009-09-30 Dave Hyatt <hyatt@apple.com>
Reviewed by Tim Hatcher.
......@@ -73,6 +73,12 @@ namespace WebCore {
{
}
JSDOMGlobalObjectData(Destructor destructor)
: JSGlobalObjectData(destructor)
, evt(0)
{
}
JSDOMStructureMap structures;
JSDOMConstructorMap constructors;
......
......@@ -42,12 +42,6 @@ namespace WebCore {
const ClassInfo JSDOMWindowBase::s_info = { "Window", 0, 0, 0 };
JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData(PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
: impl(window)
, shell(shell)
{
}
JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
: JSDOMGlobalObject(structure, new JSDOMWindowBaseData(window, shell), shell)
{
......@@ -175,6 +169,11 @@ JSGlobalData* JSDOMWindowBase::commonJSGlobalData()
return globalData;
}
void JSDOMWindowBase::destroyJSDOMWindowBaseData(void* jsDOMWindowBaseData)
{
delete static_cast<JSDOMWindowBaseData*>(jsDOMWindowBaseData);
}
// JSDOMGlobalObject* is ignored, accesing a window in any context will
// use that DOMWindow's prototype chain.
JSValue toJS(ExecState* exec, JSDOMGlobalObject*, DOMWindow* domWindow)
......
......@@ -76,7 +76,12 @@ namespace WebCore {
private:
struct JSDOMWindowBaseData : public JSDOMGlobalObjectData {
JSDOMWindowBaseData(PassRefPtr<DOMWindow>, JSDOMWindowShell*);
JSDOMWindowBaseData(PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
: JSDOMGlobalObjectData(destroyJSDOMWindowBaseData)
, impl(window)
, shell(shell)
{
}
RefPtr<DOMWindow> impl;
JSDOMWindowShell* shell;
......@@ -85,6 +90,8 @@ namespace WebCore {
bool allowsAccessFromPrivate(const JSC::JSGlobalObject*) const;
String crossDomainAccessErrorMessage(const JSC::JSGlobalObject*) const;
static void destroyJSDOMWindowBaseData(void*);
JSDOMWindowBaseData* d() const { return static_cast<JSDOMWindowBaseData*>(JSC::JSVariableObject::d); }
};
......
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