Title: [224960] trunk/Source/WebCore
Revision
224960
Author
[email protected]
Date
2017-11-16 21:49:55 -0800 (Thu, 16 Nov 2017)

Log Message

Fix occasional crash when adding and removing videos
https://bugs.webkit.org/show_bug.cgi?id=179792

Reviewed by Geoffrey Garen.

In taskCompleted we null out session, and in resume we call _restart on the main thread.
If _restart is called after taskCompleted, we want to do nothing.
Right now we are calling a method on self.session.loader which is a PlatformMediaResourceLoader&
but in ObjC if session is null it will call PlatformMediaResourceLoader::requestResource with a
null this pointer, which crashes.  Let's not crash.

* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSessionDataTask _restart]):
Early return if we don't have a session.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224959 => 224960)


--- trunk/Source/WebCore/ChangeLog	2017-11-17 03:36:59 UTC (rev 224959)
+++ trunk/Source/WebCore/ChangeLog	2017-11-17 05:49:55 UTC (rev 224960)
@@ -1,3 +1,20 @@
+2017-11-16  Alex Christensen  <[email protected]>
+
+        Fix occasional crash when adding and removing videos
+        https://bugs.webkit.org/show_bug.cgi?id=179792
+
+        Reviewed by Geoffrey Garen.
+
+        In taskCompleted we null out session, and in resume we call _restart on the main thread.
+        If _restart is called after taskCompleted, we want to do nothing.
+        Right now we are calling a method on self.session.loader which is a PlatformMediaResourceLoader&
+        but in ObjC if session is null it will call PlatformMediaResourceLoader::requestResource with a
+        null this pointer, which crashes.  Let's not crash.
+
+        * platform/network/cocoa/WebCoreNSURLSession.mm:
+        (-[WebCoreNSURLSessionDataTask _restart]):
+        Early return if we don't have a session.
+
 2017-11-16  Don Olmstead  <[email protected]>
 
         [WinCairo] Update WinCairoRequirements

Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (224959 => 224960)


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2017-11-17 03:36:59 UTC (rev 224959)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2017-11-17 05:49:55 UTC (rev 224960)
@@ -445,6 +445,10 @@
 - (void)_restart
 {
     ASSERT(isMainThread());
+
+    if (!self.session)
+        return;
+
     [self _cancel];
 
     _resource = self.session.loader.requestResource(self.originalRequest, PlatformMediaResourceLoader::LoadOption::DisallowCaching);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to