Title: [175733] trunk/Source/WebKit/mac
Revision
175733
Author
commit-qu...@webkit.org
Date
2014-11-06 18:11:16 -0800 (Thu, 06 Nov 2014)

Log Message

Wrap the bulk of -[WebView dealloc] with an autorelease pool.
https://bugs.webkit.org/show_bug.cgi?id=138443

Patch by Daniel Jalkut <jal...@red-sweater.com> on 2014-11-06
Reviewed by Anders Carlsson.

Wrapping the dealloc method in its own autorelease pool avoids the problem of
complex tear-downs leading to the WebView itself being added to an autorelease
pool that is not drained until after the instance has been dealloc'd.

* WebView/WebView.mm:
(-[WebView dealloc]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (175732 => 175733)


--- trunk/Source/WebKit/mac/ChangeLog	2014-11-07 02:02:08 UTC (rev 175732)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-11-07 02:11:16 UTC (rev 175733)
@@ -1,3 +1,17 @@
+2014-11-06  Daniel Jalkut  <jal...@red-sweater.com>
+
+        Wrap the bulk of -[WebView dealloc] with an autorelease pool.
+        https://bugs.webkit.org/show_bug.cgi?id=138443
+
+        Reviewed by Anders Carlsson.
+
+        Wrapping the dealloc method in its own autorelease pool avoids the problem of
+        complex tear-downs leading to the WebView itself being added to an autorelease
+        pool that is not drained until after the instance has been dealloc'd.
+ 
+        * WebView/WebView.mm:
+        (-[WebView dealloc]):
+
 2014-11-05  Jer Noble  <jer.no...@apple.com>
 
         De-templatize Timer

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (175732 => 175733)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2014-11-07 02:02:08 UTC (rev 175732)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2014-11-07 02:11:16 UTC (rev 175733)
@@ -5085,27 +5085,33 @@
     if (WebCoreObjCScheduleDeallocateOnMainThread([WebView class], self))
         return;
 
+    // Because the machinations of the view's shutdown may cause self to be added to
+    // active autorelease pool, we capture any such releases here to ensure they are
+    // carried out before we are dealloc'd.
+    @autoreleasepool {
+
 #if PLATFORM(IOS)
-    if (_private)
-        [_private->_geolocationProvider stopTrackingWebView:self];
+        if (_private)
+            [_private->_geolocationProvider stopTrackingWebView:self];
 #endif
 
-    // call close to ensure we tear-down completely
-    // this maintains our old behavior for existing applications
-    [self close];
+        // call close to ensure we tear-down completely
+        // this maintains our old behavior for existing applications
+        [self close];
 
-    if ([[self class] shouldIncludeInWebKitStatistics])
-        --WebViewCount;
+        if ([[self class] shouldIncludeInWebKitStatistics])
+            --WebViewCount;
 
 #if !PLATFORM(IOS)
-    if ([self _needsFrameLoadDelegateRetainQuirk])
-        [_private->frameLoadDelegate release];
+        if ([self _needsFrameLoadDelegateRetainQuirk])
+            [_private->frameLoadDelegate release];
 #endif
-        
-    [_private release];
-    // [super dealloc] can end up dispatching against _private (3466082)
-    _private = nil;
 
+        [_private release];
+        // [super dealloc] can end up dispatching against _private (3466082)
+        _private = nil;
+    }
+
     [super dealloc];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to