Changeset 155153 in webkit


Ignore:
Timestamp:
Sep 5, 2013, 3:06:31 PM (12 years ago)
Author:
ap@apple.com
Message:

WKFullScreenWindowController extends lifetime of WKView, deleting it at a wrong time
https://bugs.webkit.org/show_bug.cgi?id=120792
<rdar://problem/14884666>

Reviewed by Jer Noble.

  • UIProcess/API/mac/WKView.mm: (-[WKView fullScreenWindowController]): Use a newly minted initializer for the controller.
  • UIProcess/mac/WKFullScreenWindowController.h: Removed unused web view accessors. Changed the class to take web view at initialization time.
  • UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController initWithWindow:webView:]): Initialize the controller inone step. (-[WKFullScreenWindowController dealloc]): WebView is now a raw pointer, no need to zero it. (-[WKFullScreenWindowController close]): Make sure to not leave a dangling WKView pointer (this method is indirectly but inevitably called when WKView is deallocated).
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r155144 r155153  
     12013-09-05  Alexey Proskuryakov  <ap@apple.com>
     2
     3        WKFullScreenWindowController extends lifetime of WKView, deleting it at a wrong time
     4        https://bugs.webkit.org/show_bug.cgi?id=120792
     5        <rdar://problem/14884666>
     6
     7        Reviewed by Jer Noble.
     8
     9        * UIProcess/API/mac/WKView.mm: (-[WKView fullScreenWindowController]):
     10        Use a newly minted initializer for the controller.
     11
     12        * UIProcess/mac/WKFullScreenWindowController.h: Removed unused web view accessors.
     13        Changed the class to take web view at initialization time.
     14
     15        * UIProcess/mac/WKFullScreenWindowController.mm:
     16        (-[WKFullScreenWindowController initWithWindow:webView:]): Initialize the controller
     17        inone step.
     18        (-[WKFullScreenWindowController dealloc]): WebView is now a raw pointer, no need
     19        to zero it.
     20        (-[WKFullScreenWindowController close]): Make sure to not leave a dangling WKView
     21        pointer (this method is indirectly but inevitably called when WKView is deallocated).
     22
    1232013-09-05  Anders Carlsson  <andersca@apple.com>
    224
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r154949 r155153  
    29382938- (WKFullScreenWindowController*)fullScreenWindowController
    29392939{
    2940     if (!_data->_fullScreenWindowController) {
    2941         _data->_fullScreenWindowController = adoptNS([[WKFullScreenWindowController alloc] initWithWindow:[self createFullScreenWindow]]);
    2942         [_data->_fullScreenWindowController.get() setWebView:self];
    2943     }
     2940    if (!_data->_fullScreenWindowController)
     2941        _data->_fullScreenWindowController = adoptNS([[WKFullScreenWindowController alloc] initWithWindow:[self createFullScreenWindow] webView:self]);
     2942
    29442943    return _data->_fullScreenWindowController.get();
    29452944}
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h

    r147013 r155153  
    4747@interface WKFullScreenWindowController : NSWindowController<NSWindowDelegate> {
    4848@private
    49     WKView *_webView;
     49    WKView *_webView; // Cannot be retained, see <rdar://problem/14884666>.
    5050    RetainPtr<WebCoreFullScreenPlaceholderView> _webViewPlaceholder;
    5151    RetainPtr<WebWindowScaleAnimation> _scaleAnimation;
     
    6161}
    6262
    63 - (WKView*)webView;
    64 - (void)setWebView:(WKView*)webView;
     63- (id)initWithWindow:(NSWindow *)window webView:(WKView *)webView;
    6564
    6665- (WebCoreFullScreenPlaceholderView*)webViewPlaceholder;
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm

    r153402 r155153  
    9090#pragma mark -
    9191#pragma mark Initialization
    92 - (id)initWithWindow:(NSWindow *)window
     92- (id)initWithWindow:(NSWindow *)window webView:(WKView *)webView
    9393{
    9494    self = [super initWithWindow:window];
     
    9898    [window setCollectionBehavior:([window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary)];
    9999    [self windowDidLoad];
     100    _webView = webView;
    100101   
    101102    return self;
     
    104105- (void)dealloc
    105106{
    106     [self setWebView:nil];
    107107    [[self window] setDelegate:nil];
    108108   
     
    122122#pragma mark -
    123123#pragma mark Accessors
    124 
    125 - (WKView*)webView
    126 {
    127     return _webView;
    128 }
    129 
    130 - (void)setWebView:(WKView *)webView
    131 {
    132     [webView retain];
    133     [_webView release];
    134     _webView = webView;
    135 }
    136124
    137125- (BOOL)isFullScreen
     
    444432        [self finishedExitFullScreenAnimation:YES];
    445433
     434    _webView = nil;
     435
    446436    [super close];
    447437}
Note: See TracChangeset for help on using the changeset viewer.