Title: [199105] trunk/Source/WebCore
- Revision
- 199105
- Author
- [email protected]
- Date
- 2016-04-06 10:44:42 -0700 (Wed, 06 Apr 2016)
Log Message
CRASH in -[WebCoreNSURLSession taskCompleted:]
https://bugs.webkit.org/show_bug.cgi?id=156290
Reviewed by Eric Carlson.
Fixes currently flakily crashing http/tests/media tests.
Protect against -taskCompleted: being called multiple times by only calling
-taskCompleted: if the task's state is not yet NSURLSessionTaskStateCompleted.
Additionally, make sure to clear the task's session pointer when removing it
from _dataTasks, as this ensures a task that outlives its session does not
keep a pointer to a dealloc'd object.
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSession taskCompleted:]):
(-[WebCoreNSURLSessionDataTask _resource:loadFinishedWithError:]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (199104 => 199105)
--- trunk/Source/WebCore/ChangeLog 2016-04-06 17:36:12 UTC (rev 199104)
+++ trunk/Source/WebCore/ChangeLog 2016-04-06 17:44:42 UTC (rev 199105)
@@ -1,3 +1,22 @@
+2016-04-06 Jer Noble <[email protected]>
+
+ CRASH in -[WebCoreNSURLSession taskCompleted:]
+ https://bugs.webkit.org/show_bug.cgi?id=156290
+
+ Reviewed by Eric Carlson.
+
+ Fixes currently flakily crashing http/tests/media tests.
+
+ Protect against -taskCompleted: being called multiple times by only calling
+ -taskCompleted: if the task's state is not yet NSURLSessionTaskStateCompleted.
+ Additionally, make sure to clear the task's session pointer when removing it
+ from _dataTasks, as this ensures a task that outlives its session does not
+ keep a pointer to a dealloc'd object.
+
+ * platform/network/cocoa/WebCoreNSURLSession.mm:
+ (-[WebCoreNSURLSession taskCompleted:]):
+ (-[WebCoreNSURLSessionDataTask _resource:loadFinishedWithError:]):
+
2016-04-06 Chris Dumez <[email protected]>
[IDL] Extend support for [EnabledAtRuntime] attributes / operations to all global objects, not just Window
Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (199104 => 199105)
--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2016-04-06 17:36:12 UTC (rev 199104)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2016-04-06 17:44:42 UTC (rev 199105)
@@ -111,6 +111,7 @@
- (void)taskCompleted:(WebCoreNSURLSessionDataTask *)task
{
ASSERT(_dataTasks.contains(task));
+ task.session = nil;
_dataTasks.remove(task);
if (!_dataTasks.isEmpty() || !_invalidated)
return;
@@ -593,6 +594,10 @@
- (void)_resource:(PlatformMediaResource&)resource loadFinishedWithError:(NSError *)error
{
ASSERT_UNUSED(resource, &resource == _resource);
+ if (self.state == NSURLSessionTaskStateCompleted)
+ return;
+ self.state = NSURLSessionTaskStateCompleted;
+
RetainPtr<WebCoreNSURLSessionDataTask> strongSelf { self };
RetainPtr<NSError> strongError { error };
[self.session addDelegateOperation:[strongSelf, strongError] {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes