Title: [245076] trunk/Source/WebKitLegacy/mac
- Revision
- 245076
- Author
- [email protected]
- Date
- 2019-05-08 16:37:59 -0700 (Wed, 08 May 2019)
Log Message
[Legacy WebKit] REGRESSION (r238078): Crash in hardwareKeyboardAvailabilityChangedCallback()
https://bugs.webkit.org/show_bug.cgi?id=197724
<rdar://problem/49725959>
Reviewed by Tim Horton.
Speculative fix for race condition. Between the time we receive a kGSEventHardwareKeyboardAvailabilityChangedNotification
notification and when we schedule execution to run on the WebThread the WebView that notification
was for may no longer exist. Take out a weak ptr on the WebView when we receive the notification
and check that we still have it once we are running on the WebThread.
* WebView/WebHTMLView.mm:
(hardwareKeyboardAvailabilityChangedCallback):
Modified Paths
Diff
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (245075 => 245076)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-05-08 23:11:55 UTC (rev 245075)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-05-08 23:37:59 UTC (rev 245076)
@@ -1,3 +1,19 @@
+2019-05-08 Daniel Bates <[email protected]>
+
+ [Legacy WebKit] REGRESSION (r238078): Crash in hardwareKeyboardAvailabilityChangedCallback()
+ https://bugs.webkit.org/show_bug.cgi?id=197724
+ <rdar://problem/49725959>
+
+ Reviewed by Tim Horton.
+
+ Speculative fix for race condition. Between the time we receive a kGSEventHardwareKeyboardAvailabilityChangedNotification
+ notification and when we schedule execution to run on the WebThread the WebView that notification
+ was for may no longer exist. Take out a weak ptr on the WebView when we receive the notification
+ and check that we still have it once we are running on the WebThread.
+
+ * WebView/WebHTMLView.mm:
+ (hardwareKeyboardAvailabilityChangedCallback):
+
2019-05-08 Timothy Hatcher <[email protected]>
Add plumbing for inactive system colors in RenderTheme cache.
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (245075 => 245076)
--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2019-05-08 23:11:55 UTC (rev 245075)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2019-05-08 23:37:59 UTC (rev 245076)
@@ -146,6 +146,7 @@
#import <wtf/ObjCRuntimeExtras.h>
#import <wtf/RunLoop.h>
#import <wtf/SystemTracing.h>
+#import <wtf/WeakObjCPtr.h>
#if PLATFORM(MAC)
#import "WebNSEventExtras.h"
@@ -820,10 +821,12 @@
static void hardwareKeyboardAvailabilityChangedCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
{
ASSERT(observer);
+ auto weakWebView = WeakObjCPtr<WebHTMLView>((__bridge WebHTMLView *)observer);
WebThreadRun(^{
- WebHTMLView *webView = (__bridge WebHTMLView *)observer;
- if (Frame* coreFrame = core([webView _frame]))
- coreFrame->eventHandler().capsLockStateMayHaveChanged();
+ if (auto webView = weakWebView.get()) {
+ if (auto* coreFrame = core([webView _frame]))
+ coreFrame->eventHandler().capsLockStateMayHaveChanged();
+ }
});
}
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes