Title: [279877] trunk/Source/WebKit
- Revision
- 279877
- Author
- [email protected]
- Date
- 2021-07-13 10:10:12 -0700 (Tue, 13 Jul 2021)
Log Message
Regression(r279601) ProcessAssertion may get destroyed on a background thread
https://bugs.webkit.org/show_bug.cgi?id=227875
<rdar://76972252>
Reviewed by Geoffrey Garen.
r279601 added an internal WorkQueue to ProcessAssertion, so that we could acquire the RunningBoard assertion
asynchronously on the background queue. When dispatching to the background queue, we capture |protectedThis|,
which means that ProcessAssertion may now get destroyed on the background queue. To address the isuse, we
now make sure to dispatch |protectedThis| back to the main thread in acquireAsync().
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::acquireAsync):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (279876 => 279877)
--- trunk/Source/WebKit/ChangeLog 2021-07-13 17:05:39 UTC (rev 279876)
+++ trunk/Source/WebKit/ChangeLog 2021-07-13 17:10:12 UTC (rev 279877)
@@ -1,3 +1,19 @@
+2021-07-13 Chris Dumez <[email protected]>
+
+ Regression(r279601) ProcessAssertion may get destroyed on a background thread
+ https://bugs.webkit.org/show_bug.cgi?id=227875
+ <rdar://76972252>
+
+ Reviewed by Geoffrey Garen.
+
+ r279601 added an internal WorkQueue to ProcessAssertion, so that we could acquire the RunningBoard assertion
+ asynchronously on the background queue. When dispatching to the background queue, we capture |protectedThis|,
+ which means that ProcessAssertion may now get destroyed on the background queue. To address the isuse, we
+ now make sure to dispatch |protectedThis| back to the main thread in acquireAsync().
+
+ * UIProcess/ios/ProcessAssertionIOS.mm:
+ (WebKit::ProcessAssertion::acquireAsync):
+
2021-07-13 Kate Cheney <[email protected]>
Allow layout tests to specify app initiated loads or not
Modified: trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (279876 => 279877)
--- trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2021-07-13 17:05:39 UTC (rev 279876)
+++ trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2021-07-13 17:10:12 UTC (rev 279877)
@@ -343,10 +343,14 @@
void ProcessAssertion::acquireAsync(CompletionHandler<void()>&& completionHandler)
{
+ ASSERT(isMainRunLoop());
assertionsWorkQueue().dispatch([protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
protectedThis->acquireSync();
- if (completionHandler)
- RunLoop::main().dispatch(WTFMove(completionHandler));
+ if (completionHandler) {
+ RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)]() mutable {
+ completionHandler();
+ });
+ }
});
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes