Title: [245756] trunk/Source/WebKit
- Revision
- 245756
- Author
- [email protected]
- Date
- 2019-05-24 15:13:02 -0700 (Fri, 24 May 2019)
Log Message
Crash under WebCore::TimerBase::~TimerBase after a download is canceled
https://bugs.webkit.org/show_bug.cgi?id=197927
rdar://problem/50822728
Reviewed by Ryosuke Niwa.
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::platformCancelNetworkLoad):
CFNetwork makes no guarantees about what thread is used to call the completion block
passed to -[NSURLSessionDownloadTask cancelByProducingResumeData], and in some cases,
it can be called on a background queue. This eventually causes the Download to be
deallocated on the background queue, which triggers a release assertion failure in
~TimerBase. When CFNetwork finishes canceling the download, we should move to the
main thread before calling didCancel().
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (245755 => 245756)
--- trunk/Source/WebKit/ChangeLog 2019-05-24 21:47:36 UTC (rev 245755)
+++ trunk/Source/WebKit/ChangeLog 2019-05-24 22:13:02 UTC (rev 245756)
@@ -1,3 +1,20 @@
+2019-05-24 David Quesada <[email protected]>
+
+ Crash under WebCore::TimerBase::~TimerBase after a download is canceled
+ https://bugs.webkit.org/show_bug.cgi?id=197927
+ rdar://problem/50822728
+
+ Reviewed by Ryosuke Niwa.
+
+ * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
+ (WebKit::Download::platformCancelNetworkLoad):
+ CFNetwork makes no guarantees about what thread is used to call the completion block
+ passed to -[NSURLSessionDownloadTask cancelByProducingResumeData], and in some cases,
+ it can be called on a background queue. This eventually causes the Download to be
+ deallocated on the background queue, which triggers a release assertion failure in
+ ~TimerBase. When CFNetwork finishes canceling the download, we should move to the
+ main thread before calling didCancel().
+
2019-05-24 Youenn Fablet <[email protected]>
Update messages_unittest.py after r245715
Modified: trunk/Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm (245755 => 245756)
--- trunk/Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm 2019-05-24 21:47:36 UTC (rev 245755)
+++ trunk/Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm 2019-05-24 22:13:02 UTC (rev 245756)
@@ -81,10 +81,12 @@
{
ASSERT(m_downloadTask);
[m_downloadTask cancelByProducingResumeData:^(NSData *resumeData) {
- if (resumeData && resumeData.bytes && resumeData.length)
- didCancel(IPC::DataReference(reinterpret_cast<const uint8_t*>(resumeData.bytes), resumeData.length));
- else
- didCancel({ });
+ callOnMainThread([this, resumeData = retainPtr(resumeData)] {
+ if (resumeData && resumeData.get().bytes && resumeData.get().length)
+ didCancel(IPC::DataReference(reinterpret_cast<const uint8_t*>(resumeData.get().bytes), resumeData.get().length));
+ else
+ didCancel({ });
+ });
}];
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes