Title: [274500] trunk/Source/WebKitLegacy/mac
- Revision
- 274500
- Author
- an...@apple.com
- Date
- 2021-03-16 11:39:20 -0700 (Tue, 16 Mar 2021)
Log Message
REGRESSION (r272300): [iOS] ASSERTION FAILED: Unsafe to ref/deref from different threads under WebViewLayerFlushScheduler::layerFlushCallback
https://bugs.webkit.org/show_bug.cgi?id=222712
<rdar://problem/75022845>
Reviewed by Simon Fraser.
We are scheduling a layer flush from a layerFlushCallback and so rescheduling the RunLoopObserver.
This is fine in itself but becomes a problem when the main thread web lock auto-unlock observer
runs before that observer. Then that layer flush runs without the web lock held and messes up
ref/deref main thread asserts (isMainThread() returns false when the web lock is not held).
* WebView/WebViewData.mm:
(WebViewLayerFlushScheduler::layerFlushCallback):
Fix by explicitly taking the lock.
Modified Paths
Diff
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (274499 => 274500)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2021-03-16 18:35:16 UTC (rev 274499)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2021-03-16 18:39:20 UTC (rev 274500)
@@ -1,5 +1,23 @@
2021-03-16 Antti Koivisto <an...@apple.com>
+ REGRESSION (r272300): [iOS] ASSERTION FAILED: Unsafe to ref/deref from different threads under WebViewLayerFlushScheduler::layerFlushCallback
+ https://bugs.webkit.org/show_bug.cgi?id=222712
+ <rdar://problem/75022845>
+
+ Reviewed by Simon Fraser.
+
+ We are scheduling a layer flush from a layerFlushCallback and so rescheduling the RunLoopObserver.
+ This is fine in itself but becomes a problem when the main thread web lock auto-unlock observer
+ runs before that observer. Then that layer flush runs without the web lock held and messes up
+ ref/deref main thread asserts (isMainThread() returns false when the web lock is not held).
+
+ * WebView/WebViewData.mm:
+ (WebViewLayerFlushScheduler::layerFlushCallback):
+
+ Fix by explicitly taking the lock.
+
+2021-03-16 Antti Koivisto <an...@apple.com>
+
[WebView _touchEventRegions] needs to take the web lock
https://bugs.webkit.org/show_bug.cgi?id=223266
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm (274499 => 274500)
--- trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm 2021-03-16 18:35:16 UTC (rev 274499)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm 2021-03-16 18:39:20 UTC (rev 274500)
@@ -48,6 +48,7 @@
#if PLATFORM(IOS_FAMILY)
#import "WebGeolocationProviderIOS.h"
#import <WebCore/RuntimeApplicationChecks.h>
+#import <WebCore/WebCoreThread.h>
#import <WebCore/WebCoreThreadInternal.h>
#endif
@@ -122,6 +123,12 @@
void WebViewLayerFlushScheduler::layerFlushCallback()
{
+#if PLATFORM(IOS_FAMILY)
+ // Normally the layer flush callback happens before the web lock auto-unlock observer runs.
+ // However if the flush is rescheduled from the callback it may get pushed past it, to the next cycle.
+ WebThreadLock();
+#endif
+
@autoreleasepool {
RefPtr<LayerFlushController> protector = m_flushController;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes