Fixed https://bugs.webkit.org/show_bug.cgi?id=29941
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2009 00:40:10 +0000 (00:40 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2009 00:40:10 +0000 (00:40 +0000)
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

WebCore/ChangeLog
WebCore/bindings/js/JSDOMGlobalObject.h
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSDOMWindowBase.h

index bdae905efec5677e24282114071b58c9a8b96239..edc9450d269ce78d32864c984669818219c4eb75 100644 (file)
@@ -1,3 +1,18 @@
+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.
index 00c3bbf1bc2afb4c14bd7bd38e31b3d02696b132..ce26857062cd49cff11ef47a50a8fbcf751f52f4 100644 (file)
@@ -73,6 +73,12 @@ namespace WebCore {
             {
             }
 
+            JSDOMGlobalObjectData(Destructor destructor)
+                : JSGlobalObjectData(destructor)
+                , evt(0)
+            {
+            }
+
             JSDOMStructureMap structures;
             JSDOMConstructorMap constructors;
 
index fe4d59c012ff49fa97ded14937f6819e90ac38ba..a04ef89e00d5f0b4d75ee0e832ec7046cb374eb8 100644 (file)
@@ -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)
index 09fe4bc4a880cfc60c782cd0e7ef324eb25bfba6..52c3c1d8e938a03895a31afb013e61675d38a65d 100644 (file)
@@ -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); }
     };