Changeset 85051 in webkit


Ignore:
Timestamp:
Apr 27, 2011 8:10:12 AM (13 years ago)
Author:
yurys@chromium.org
Message:

2011-04-27 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector
https://bugs.webkit.org/show_bug.cgi?id=44230

Use RetainPtr access inspected view from the inspector one to avoid inspected view being deleted before
inspector is closed.

  • WebCoreSupport/WebInspectorClient.mm: store reference to inspected view in RetainPtr. Despite the removed comment in initWithInspectedWebView this doesn't introduce cyclic reference since there are no retaining pointers to the WebInspectorWindowController from the inspected page or from the WebInspectorClient. There is only one reference to it from WebInspectorFrontendClient which is held by the inspector front-end page.

Drive-by fix: removed several unused methods which are currently implemented in mac/WebInspector/WebInspector.mm
(-[WebInspectorWindowController initWithInspectedWebView:]):
(-[WebInspectorWindowController close]):
(-[WebInspectorWindowController showWindow:]):
(-[WebInspectorWindowController setAttachedWindowHeight:]):
(-[WebInspectorWindowController destroyInspectorView:]):

Location:
trunk/Source/WebKit/mac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r84991 r85051  
     12011-04-27  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector
     6        https://bugs.webkit.org/show_bug.cgi?id=44230
     7
     8        Use RetainPtr access inspected view from the inspector one to avoid inspected view being deleted before
     9        inspector is closed.
     10
     11        * WebCoreSupport/WebInspectorClient.mm: store reference to inspected view in RetainPtr. Despite the removed
     12        comment in initWithInspectedWebView this doesn't introduce cyclic reference since there are no retaining
     13        pointers to the WebInspectorWindowController from the inspected page or from the WebInspectorClient.
     14        There is only one reference to it from WebInspectorFrontendClient which is held by the inspector
     15        front-end page.
     16
     17        Drive-by fix: removed several unused methods which are currently implemented in mac/WebInspector/WebInspector.mm
     18        (-[WebInspectorWindowController initWithInspectedWebView:]):
     19        (-[WebInspectorWindowController close]):
     20        (-[WebInspectorWindowController showWindow:]):
     21        (-[WebInspectorWindowController setAttachedWindowHeight:]):
     22        (-[WebInspectorWindowController destroyInspectorView:]):
     23
    1242011-04-26  Sam Weinig  <sam@webkit.org>
    225
  • trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm

    r85036 r85051  
    5050@interface WebInspectorWindowController : NSWindowController <NSWindowDelegate> {
    5151@private
    52     WebView *_inspectedWebView;
     52    RetainPtr<WebView> _inspectedWebView;
    5353    WebView *_webView;
    5454    WebInspectorFrontendClient* _frontendClient;
     
    264264        return nil;
    265265
    266     // Don't retain to avoid a circular reference.
    267266    _inspectedWebView = webView;
    268267    return self;
     
    324323
    325324    if (_attachedToInspectedWebView) {
    326         if ([_inspectedWebView _isClosed])
     325        if ([_inspectedWebView.get() _isClosed])
    327326            return;
    328327
    329328        [_webView removeFromSuperview];
    330329
    331         WebFrameView *frameView = [[_inspectedWebView mainFrame] frameView];
     330        WebFrameView *frameView = [[_inspectedWebView.get() mainFrame] frameView];
    332331        NSRect frameViewRect = [frameView frame];
    333332
     
    340339        [frameView setFrame:frameViewRect];
    341340
    342         [_inspectedWebView displayIfNeeded];
     341        [_inspectedWebView.get() displayIfNeeded];
    343342    } else
    344343        [super close];
     
    361360
    362361    if (_shouldAttach) {
    363         WebFrameView *frameView = [[_inspectedWebView mainFrame] frameView];
     362        WebFrameView *frameView = [[_inspectedWebView.get() mainFrame] frameView];
    364363
    365364        [_webView removeFromSuperview];
    366         [_inspectedWebView addSubview:_webView positioned:NSWindowBelow relativeTo:(NSView *)frameView];
     365        [_inspectedWebView.get() addSubview:_webView positioned:NSWindowBelow relativeTo:(NSView *)frameView];
    367366
    368367        [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable | NSViewMaxYMargin)];
     
    432431        return;
    433432
    434     WebFrameView *frameView = [[_inspectedWebView mainFrame] frameView];
     433    WebFrameView *frameView = [[_inspectedWebView.get() mainFrame] frameView];
    435434    NSRect frameViewRect = [frameView frame];
    436435
     
    457456
    458457    if (notifyInspectorController) {
    459         if (Page* inspectedPage = [_inspectedWebView page])
     458        if (Page* inspectedPage = [_inspectedWebView.get() page])
    460459            inspectedPage->inspectorController()->disconnectFrontend();
    461460
     
    474473}
    475474
    476 // MARK: -
    477 
    478 // These methods can be used by UI elements such as menu items and toolbar buttons when the inspector is the key window.
    479 
    480 // This method is really only implemented to keep any UI elements enabled.
    481 - (void)showWebInspector:(id)sender
    482 {
    483     [[_inspectedWebView inspector] show:sender];
    484 }
    485 
    486 - (void)showErrorConsole:(id)sender
    487 {
    488     [[_inspectedWebView inspector] showConsole:sender];
    489 }
    490 
    491 - (void)toggleDebuggingJavaScript:(id)sender
    492 {
    493     [[_inspectedWebView inspector] toggleDebuggingJavaScript:sender];
    494 }
    495 
    496 - (void)toggleProfilingJavaScript:(id)sender
    497 {
    498     [[_inspectedWebView inspector] toggleProfilingJavaScript:sender];
    499 }
    500 
    501 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
    502 {
    503     BOOL isMenuItem = [(id)item isKindOfClass:[NSMenuItem class]];
    504     if ([item action] == @selector(toggleDebuggingJavaScript:) && isMenuItem) {
    505         NSMenuItem *menuItem = (NSMenuItem *)item;
    506         if ([[_inspectedWebView inspector] isDebuggingJavaScript])
    507             [menuItem setTitle:UI_STRING_INTERNAL("Stop Debugging JavaScript", "title for Stop Debugging JavaScript menu item")];
    508         else
    509             [menuItem setTitle:UI_STRING_INTERNAL("Start Debugging JavaScript", "title for Start Debugging JavaScript menu item")];
    510     } else if ([item action] == @selector(toggleProfilingJavaScript:) && isMenuItem) {
    511         NSMenuItem *menuItem = (NSMenuItem *)item;
    512         if ([[_inspectedWebView inspector] isProfilingJavaScript])
    513             [menuItem setTitle:UI_STRING_INTERNAL("Stop Profiling JavaScript", "title for Stop Profiling JavaScript menu item")];
    514         else
    515             [menuItem setTitle:UI_STRING_INTERNAL("Start Profiling JavaScript", "title for Start Profiling JavaScript menu item")];
    516     }
    517 
    518     return YES;
    519 }
    520 
    521475@end
Note: See TracChangeset for help on using the changeset viewer.