Bug 197724

Summary: [Legacy WebKit] REGRESSION (r238078): Crash in hardwareKeyboardAvailabilityChangedCallback()
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebKit Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar, PlatformOnly, Regression
Version: WebKit Local Build   
Hardware: iPhone / iPad   
OS: iOS 12   
Bug Depends on: 190565    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description Daniel Bates 2019-05-08 16:24:12 PDT
Sometimes we crash in Legacy WebKit inside hardwareKeyboardAvailabilityChangedCallback(). Here's a snippet from the crash report:

Application Specific Information:
objc_msgSend() selector name: _frame

Thread 4 Crashed:
0   libobjc.A.dylib                      0x00000001ec272530 objc_msgSend + 16
1   WebKitLegacy                         0x00000001f733c61c ___ZL43hardwareKeyboardAvailabilityChangedCallbackP22__CFNotificationCenterPvPK10__CFStringPKvPK14__CFDictionary_block_invoke + 20
2   WebCore                              0x00000001f6b97624 HandleRunSource(void*) + 712
3   CoreFoundation                       0x00000001ed0112bc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20
4   CoreFoundation                       0x00000001ed01123c __CFRunLoopDoSource0 + 84
5   CoreFoundation                       0x00000001ed010b74 __CFRunLoopDoSources0 + 252
6   CoreFoundation                       0x00000001ed00ba60 __CFRunLoopRun + 1000
7   CoreFoundation                       0x00000001ed00b354 CFRunLoopRunSpecific + 432
8   WebCore                              0x00000001f5c65480 RunWebThread(void*) + 596
9   libsystem_pthread.dylib              0x00000001ecc9f2c0 _pthread_body + 124
10  libsystem_pthread.dylib              0x00000001ecc9f220 _pthread_start + 40
11  libsystem_pthread.dylib              0x00000001ecca2cdc thread_start + 0
Comment 1 Daniel Bates 2019-05-08 16:24:55 PDT
<rdar://problem/49725959>
Comment 2 Daniel Bates 2019-05-08 16:30:00 PDT
Created attachment 369444 [details]
Patch
Comment 3 Tim Horton 2019-05-08 16:36:37 PDT
Comment on attachment 369444 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=369444&action=review

> Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:824
> +    auto weakWebView = WeakObjCPtr<WebHTMLView>((__bridge WebHTMLView *)observer);

You can probably just __weak, but this is fine too
Comment 4 Daniel Bates 2019-05-08 16:38:03 PDT
Comment on attachment 369444 [details]
Patch

Clearing flags on attachment: 369444

Committed r245076: <https://trac.webkit.org/changeset/245076>
Comment 5 Daniel Bates 2019-05-08 16:38:04 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Wenson Hsieh 2019-05-08 19:01:09 PDT
*** Bug 197124 has been marked as a duplicate of this bug. ***