Modified: trunk/Source/WebKit/ChangeLog (229171 => 229172)
--- trunk/Source/WebKit/ChangeLog 2018-03-02 10:47:23 UTC (rev 229171)
+++ trunk/Source/WebKit/ChangeLog 2018-03-02 16:52:32 UTC (rev 229172)
@@ -1,3 +1,16 @@
+2018-03-02 Youenn Fablet <[email protected]>
+
+ IOChannel::read and IOChannel::write can destroy the completion handler in the thread used to manipulate thread
+ https://bugs.webkit.org/show_bug.cgi?id=183261
+
+ Reviewed by Antti Koivisto.
+
+ Moving the completion handler when being called so that it gets desttroyed in the thread it is called.
+
+ * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
+ (WebKit::NetworkCache::IOChannel::read):
+ (WebKit::NetworkCache::IOChannel::write):
+
2018-03-02 Dan Bernstein <[email protected]>
Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm (229171 => 229172)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm 2018-03-02 10:47:23 UTC (rev 229171)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm 2018-03-02 16:52:32 UTC (rev 229172)
@@ -102,7 +102,8 @@
return;
DispatchPtr<dispatch_data_t> fileDataPtr(fileData);
Data data(fileDataPtr);
- completionHandler(data, error);
+ auto callback = WTFMove(completionHandler);
+ callback(data, error);
didCallCompletionHandler = true;
}).get());
}
@@ -112,9 +113,10 @@
RefPtr<IOChannel> channel(this);
auto dispatchData = data.dispatchData();
auto dispatchQueue = queue ? queue->dispatchQueue() : dispatch_get_main_queue();
- dispatch_io_write(m_dispatchIO.get(), offset, dispatchData, dispatchQueue, BlockPtr<void(bool, dispatch_data_t, int)>::fromCallable([channel, completionHandler = WTFMove(completionHandler)](bool done, dispatch_data_t fileData, int error) {
+ dispatch_io_write(m_dispatchIO.get(), offset, dispatchData, dispatchQueue, BlockPtr<void(bool, dispatch_data_t, int)>::fromCallable([channel, completionHandler = WTFMove(completionHandler)](bool done, dispatch_data_t fileData, int error) mutable {
ASSERT_UNUSED(done, done);
- completionHandler(error);
+ auto callback = WTFMove(completionHandler);
+ callback(error);
}).get());
}