Reviewed by Maciej.
authoraliceli1 <aliceli1@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Oct 2006 10:01:58 +0000 (10:01 +0000)
committeraliceli1 <aliceli1@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Oct 2006 10:01:58 +0000 (10:01 +0000)
        fix leaks.

        * WebCoreSupport/WebEditorClient.mm:
        (WebEditorClient::setWebView):
        only change webview if its different

        * WebCoreSupport/WebFrameBridge.m:
        (-[WebFrameBridge initSubframeWithOwnerElement:frameName:view:]):
        actually use the client allocated in the line above instead of
        allocation again, duh.

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

WebKit/ChangeLog
WebKit/WebCoreSupport/WebEditorClient.mm
WebKit/WebCoreSupport/WebFrameBridge.m

index 6b5a601b050c1199a4ca4f8443ff40e73db7cf70..a8a55f540a7f2e2f81e3fb533b00dac0f43caf00 100644 (file)
@@ -1,3 +1,18 @@
+2006-10-21  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Maciej.
+
+        fix leaks.
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::setWebView):
+        only change webview if its different
+
+        * WebCoreSupport/WebFrameBridge.m:
+        (-[WebFrameBridge initSubframeWithOwnerElement:frameName:view:]):
+        actually use the client allocated in the line above instead of
+        allocation again, duh. 
+
 2006-10-21  Alice Liu  <alice.liu@apple.com>
 
         Build fix.
index fbada10127ea2571cdcb2f266df4877a320f7c0a..fdc7456a86e31daa111f5deb368f0abe7e186be3 100644 (file)
@@ -52,9 +52,11 @@ WebEditorClient::~WebEditorClient()
 
 void WebEditorClient::setWebView(WebView* webView)
 { 
-    [m_webView release];
-    m_webView = webView; 
-    [m_webView retain];
+    if (m_webView != webView) {
+        [m_webView release];
+        m_webView = webView; 
+        [m_webView retain];
+    }
 }
 
 bool WebEditorClient::shouldDeleteRange(Range *range)
index c2d9c2a3d418ce9acddfcfa6f572294eaebb953c..ca4cd3b79def18ed00646fa7d1256e955a568f85 100644 (file)
@@ -134,10 +134,9 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
 - (id)initSubframeWithOwnerElement:(WebCoreElement *)ownerElement frameName:(NSString *)name view:(WebFrameView *)view
 {
     WebEditorClient* editorClient = new WebEditorClient();
-    self = [super initSubframeWithOwnerElement:ownerElement withEditorClient:new WebEditorClient()];
+    self = [super initSubframeWithOwnerElement:ownerElement withEditorClient:editorClient];
     _frame = [[WebFrame alloc] _initWithWebFrameView:view webView:[self webView] bridge:self];
     editorClient->setWebView([self webView]);
-    editorClient->deref();
     ++WebBridgeCount;
 
     [self setName:name];