Changeset 25792 in webkit


Ignore:
Timestamp:
Sep 27, 2007 10:56:51 PM (17 years ago)
Author:
sullivan
Message:

Reviewed by Ollie


  • fixed <rdar://problem/5408186> REGRESSION (5522-5523.9): Safari leaks every browser window


The leak started occurring when we removed the code to clear the delegates and the host window
from Safari as part of the fix for 5479443. But it turns out that Safari code was masking a
bug here in WebView: setHostWindow:nil needs to be called before setting _private->closed to
YES, or it will do nothing at all, causing a world leak due to a circular reference between
the window and the WebView.


I toyed with a more complex fix, but this is the simplest one that retains the fix for 5479443
while otherwise restoring the code order to be as close as possible to what it was before
5479443 was fixed.

  • WebView/WebView.mm: (-[WebView _close]): Moved the call that sets _private->closed to YES to be after the code that clears the delegates and the host window. Added a comment about this order.
Location:
trunk/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r25787 r25792  
     12007-09-27  John Sullivan  <sullivan@apple.com>
     2
     3        Reviewed by Ollie
     4       
     5        - fixed <rdar://problem/5408186> REGRESSION (5522-5523.9): Safari leaks every browser window
     6       
     7        The leak started occurring when we removed the code to clear the delegates and the host window
     8        from Safari as part of the fix for 5479443. But it turns out that Safari code was masking a
     9        bug here in WebView: setHostWindow:nil needs to be called before setting _private->closed to
     10        YES, or it will do nothing at all, causing a world leak due to a circular reference between
     11        the window and the WebView.
     12       
     13        I toyed with a more complex fix, but this is the simplest one that retains the fix for 5479443
     14        while otherwise restoring the code order to be as close as possible to what it was before
     15        5479443 was fixed.
     16
     17        * WebView/WebView.mm:
     18        (-[WebView _close]):
     19        Moved the call that sets _private->closed to YES to be after the code that clears the delegates
     20        and the host window. Added a comment about this order.
     21
    1222007-09-27  Kevin Decker  <kdecker@apple.com>
    223
  • trunk/WebKit/WebView/WebView.mm

    r25718 r25792  
    680680    if (!_private || _private->closed)
    681681        return;
    682     _private->closed = YES;
    683682
    684683    FrameLoader* mainFrameLoader = [[self mainFrame] _frameLoader];
     
    697696    [self setScriptDebugDelegate:nil];
    698697    [self setUIDelegate:nil];
     698   
     699    // setHostWindow:nil must be called before this value is set (see 5408186)
     700    _private->closed = YES;
    699701
    700702    // To avoid leaks, call removeDragCaret in case it wasn't called after moveDragCaretToPoint.
Note: See TracChangeset for help on using the changeset viewer.