2006-09-14 Mark Rowe <opendarwin.org@bdash.net.nz>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Sep 2006 06:09:02 +0000 (06:09 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Sep 2006 06:09:02 +0000 (06:09 +0000)
        Reviewed by Adam.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=10838
        Bug 10838: REGRESSION: Leaking of WebScriptObjectPrivate

        FrameMac relies on its cleanupPluginObjects being called to perform cleanup.  The virtual
        Frame::cleanupPluginObjects method is called from Frame's destructor, which results
        in Frame::cleanupPluginObjects being called rather than FrameMac::cleanupPluginObjects.

        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::~FrameMac): Call cancelAndClear to ensure that FrameMac::cleanupPluginObjects
        will be called from Frame::clear
        * page/Frame.cpp:
        (WebCore::Frame::~Frame): Use cancelAndClear.
        (WebCore::Frame::cancelAndClear): Move cancellation and clearing into a separate method that
        FrameMac can use.
        * page/Frame.h:

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

WebCore/ChangeLog
WebCore/bridge/mac/FrameMac.mm
WebCore/page/Frame.cpp
WebCore/page/Frame.h

index 5aa391522abd505952d7fc49f29e9e80c5e65484..4fd23cb3fc9b1bd08843e7e017fc015f11c59f17 100644 (file)
@@ -1,3 +1,23 @@
+2006-09-14  Mark Rowe  <opendarwin.org@bdash.net.nz>
+
+        Reviewed by Adam.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10838
+        Bug 10838: REGRESSION: Leaking of WebScriptObjectPrivate
+
+        FrameMac relies on its cleanupPluginObjects being called to perform cleanup.  The virtual
+        Frame::cleanupPluginObjects method is called from Frame's destructor, which results
+        in Frame::cleanupPluginObjects being called rather than FrameMac::cleanupPluginObjects.
+
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::~FrameMac): Call cancelAndClear to ensure that FrameMac::cleanupPluginObjects
+        will be called from Frame::clear
+        * page/Frame.cpp:
+        (WebCore::Frame::~Frame): Use cancelAndClear.
+        (WebCore::Frame::cancelAndClear): Move cancellation and clearing into a separate method that
+        FrameMac can use.
+        * page/Frame.h:
+
 2006-09-14  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Maciej's rubber stamp
index e6dbc4b237058946a6aa6eb38d2ee8a174614696..f01f8998bf542b7cfe3009e2f1c718acabd6c7a2 100644 (file)
@@ -176,6 +176,8 @@ FrameMac::~FrameMac()
     [_bridge clearFrame];
     HardRelease(_bridge);
     _bridge = nil;
+
+    cancelAndClear();
 }
 
 void FrameMac::freeClipboard()
index 0d59c95de8239ad113d70e4149e4bd4014d87d6a..402d00325d8f8921c28c55b1763e839c96d97471 100644 (file)
@@ -190,12 +190,7 @@ Frame::~Frame()
     --FrameCounter::count;
 #endif
 
-    cancelRedirection();
-
-    if (!d->m_bComplete)
-        closeURL();
-
-    clear(false);
+    cancelAndClear();
 
     if (d->m_jscript && d->m_jscript->haveInterpreter())
         if (Window* w = Window::retrieveWindow(this)) {
@@ -462,6 +457,16 @@ bool Frame::autoloadImages() const
   return true;
 }
 
+void Frame::cancelAndClear()
+{
+    cancelRedirection();
+
+    if (!d->m_bComplete)
+        closeURL();
+
+    clear(false);
+}
+
 void Frame::clear(bool clearWindowProperties)
 {
   if (d->m_bCleared)
index 5ab2e0307b4b235f6899900bd502fbe31ed1c830..6091f40dd8269856d91010a993a2f2492cf685fc 100644 (file)
@@ -756,6 +756,7 @@ protected:
     virtual void startRedirectionTimer();
     virtual void stopRedirectionTimer();
     virtual void cleanupPluginObjects() { }
+    void cancelAndClear();
     
     void handleAutoscroll(RenderLayer*);
     void startAutoscrollTimer();