Reviewed by Kevin Decker.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Aug 2006 19:58:53 +0000 (19:58 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Aug 2006 19:58:53 +0000 (19:58 +0000)
        <rdar://problem/4633896> -[WebView close] should clear all delegates and call setHostWindow:nil
        <rdar://problem/4649759> Crash when selecting View Source menu using Chinese (-[WebView _close])

        Check to make sure _private is not null. A WebView can be dealloced before _private is setup.
        Set the _private->closed flag at the beginning of _close to prevent reentry.
        Set the host window and all the delegates to nil in _close.

        * WebView/WebView.m:
        (-[WebView _close]):

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

WebKit/ChangeLog
WebKit/WebView/WebView.m

index cca2ff5045d5272e711bcdb8a8bb988d37ac968d..93e7bce5c64634161ac358938c56ed65dde6b7e3 100644 (file)
@@ -1,3 +1,17 @@
+2006-08-17  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Kevin Decker.
+
+        <rdar://problem/4633896> -[WebView close] should clear all delegates and call setHostWindow:nil
+        <rdar://problem/4649759> Crash when selecting View Source menu using Chinese (-[WebView _close])
+
+        Check to make sure _private is not null. A WebView can be dealloced before _private is setup.
+        Set the _private->closed flag at the beginning of _close to prevent reentry.
+        Set the host window and all the delegates to nil in _close.
+
+        * WebView/WebView.m:
+        (-[WebView _close]):
+
 2006-08-16  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Maciej
index bc89ebb99ff636d0c29a2d44ecea6568d20634ad..34e6228bab15e84f82a3ddad6c5512aa208dd862 100644 (file)
@@ -592,15 +592,25 @@ static bool debugWidget = true;
 
 - (void)_close
 {
-    if (_private->closed)
+    if (!_private || _private->closed)
         return;
+    _private->closed = YES;
 
     [self _removeFromAllWebViewsSet];
+
     [self setGroupName:nil];
+    [self setHostWindow:nil];
+    [self setDownloadDelegate:nil];
+    [self setEditingDelegate:nil];
+    [self setFrameLoadDelegate:nil];
+    [self setPolicyDelegate:nil];
+    [self setResourceLoadDelegate:nil];
+    [self setScriptDebugDelegate:nil];
+    [self setUIDelegate:nil];
 
     // To avoid leaks, call removeDragCaret in case it wasn't called after moveDragCaretToPoint.
     [self removeDragCaret];
-    
+
     [[self mainFrame] _detachFromParent];
     [_private->_pageBridge close];
     [_private->_pageBridge release];
@@ -628,8 +638,6 @@ static bool debugWidget = true;
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
     [WebPreferences _removeReferenceForIdentifier: [self preferencesIdentifier]];
-
-    _private->closed = YES;
 }
 
 + (NSString *)_MIMETypeForFile:(NSString *)path