Changeset 199105 in webkit


Ignore:
Timestamp:
Apr 6, 2016 10:44:42 AM (8 years ago)
Author:
jer.noble@apple.com
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:]):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r199103 r199105  
     12016-04-06  Jer Noble  <jer.noble@apple.com>
     2
     3        CRASH in -[WebCoreNSURLSession taskCompleted:]
     4        https://bugs.webkit.org/show_bug.cgi?id=156290
     5
     6        Reviewed by Eric Carlson.
     7
     8        Fixes currently flakily crashing http/tests/media tests.
     9
     10        Protect against -taskCompleted: being called multiple times by only calling
     11        -taskCompleted: if the task's state is not yet NSURLSessionTaskStateCompleted.
     12        Additionally, make sure to clear the task's session pointer when removing it
     13        from _dataTasks, as this ensures a task that outlives its session does not
     14        keep a pointer to a dealloc'd object.
     15
     16        * platform/network/cocoa/WebCoreNSURLSession.mm:
     17        (-[WebCoreNSURLSession taskCompleted:]):
     18        (-[WebCoreNSURLSessionDataTask _resource:loadFinishedWithError:]):
     19
    1202016-04-06  Chris Dumez  <cdumez@apple.com>
    221
  • trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm

    r198566 r199105  
    112112{
    113113    ASSERT(_dataTasks.contains(task));
     114    task.session = nil;
    114115    _dataTasks.remove(task);
    115116    if (!_dataTasks.isEmpty() || !_invalidated)
     
    594595{
    595596    ASSERT_UNUSED(resource, &resource == _resource);
     597    if (self.state == NSURLSessionTaskStateCompleted)
     598        return;
     599    self.state = NSURLSessionTaskStateCompleted;
     600
    596601    RetainPtr<WebCoreNSURLSessionDataTask> strongSelf { self };
    597602    RetainPtr<NSError> strongError { error };
Note: See TracChangeset for help on using the changeset viewer.