Bug 186370

Summary: Crash in lambda function WTF::Function<void ()>::CallableWrapper<WebKit::DisplayLink::displayLinkCallback
Product: WebKit Reporter: Per Arne Vollan <pvollan>
Component: WebKit Misc.Assignee: Per Arne Vollan <pvollan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Per Arne Vollan 2018-06-06 16:32:50 PDT
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff6665e1be __abort_with_payload + 10
1   libsystem_kernel.dylib        	0x00007fff66658202 abort_with_payload_wrapper_internal + 82
2   libsystem_kernel.dylib        	0x00007fff666581b0 abort_with_reason + 22
3   libobjc.A.dylib               	0x00007fff6557c63b _objc_fatalv(unsigned long long, unsigned long long, char const*, __va_list_tag*) + 108
4   libobjc.A.dylib               	0x00007fff6557c4fd _objc_fatal(char const*, ...) + 127
5   libobjc.A.dylib               	0x00007fff6557ffd1 checkIsKnownClass(objc_class*) + 52
6   libobjc.A.dylib               	0x00007fff6556cd9b lookUpImpOrForward + 116
7   libobjc.A.dylib               	0x00007fff6556c894 _objc_msgSend_uncached + 68
8   com.apple.WebKit              	0x00007fff48392a8b WTF::Function<void ()>::CallableWrapper<WebKit::DisplayLink::displayLinkCallback(__CVDisplayLink*, CVTimeStamp const*, CVTimeStamp const*, unsigned long long, unsigned long long*, void*)::$_0>::~CallableWrapper() + 39
9   com.apple.JavaScriptCore      	0x00007fff3c993917 WTF::dispatchFunctionsFromMainThread() + 263
10  com.apple.Foundation          	0x00007fff3b6ff0a4 __NSThreadPerformPerform + 325
11  com.apple.CoreFoundation      	0x00007fff392ea69e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
12  com.apple.CoreFoundation      	0x00007fff3938bada __CFRunLoopDoSource0 + 108
13  com.apple.CoreFoundation      	0x00007fff392d0d8b __CFRunLoopDoSources0 + 228
14  com.apple.CoreFoundation      	0x00007fff392d030f __CFRunLoopRun + 1246
15  com.apple.CoreFoundation      	0x00007fff392cfc0d CFRunLoopRunSpecific + 510
16  com.apple.HIToolbox           	0x00007fff3856ff4d RunCurrentEventLoopInMode + 293
17  com.apple.HIToolbox           	0x00007fff3856fc87 ReceiveNextEventCommon + 618
18  com.apple.HIToolbox           	0x00007fff3856fa04 _BlockUntilNextEventMatchingListInModeWithFilter + 64
19  com.apple.AppKit              	0x00007fff368b8dd2 _DPSNextEvent + 1000
20  com.apple.AppKit              	0x00007fff36ff6f48 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1356
21  com.apple.Safari.framework    	0x00007fff5d48575a -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 273
22  com.apple.AppKit              	0x00007fff368ae66e -[NSApplication run] + 699
23  com.apple.AppKit              	0x00007fff3687e87a NSApplicationMain + 780
24  libdyld.dylib                 	0x00007fff664f0f44 0x7fff664f0000 + 3908
Comment 1 Per Arne Vollan 2018-06-06 16:34:48 PDT
<rdar://problem/40439109>
Comment 2 Per Arne Vollan 2018-06-06 16:47:12 PDT
Created attachment 342095 [details]
Patch
Comment 3 Brent Fulgham 2018-06-06 16:50:39 PDT
Comment on attachment 342095 [details]
Patch

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

r=me, if EWS is satisfied.

> Source/WebKit/UIProcess/mac/DisplayLink.cpp:101
> +    RunLoop::main().dispatch([weakPtr = webPageProxy->createWeakPtr()] {

You should be able to use "weakPtr = makeWeakPtr(*webPageProxy)"
Comment 4 Per Arne Vollan 2018-06-06 17:17:04 PDT
(In reply to Brent Fulgham from comment #3)
> Comment on attachment 342095 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=342095&action=review
> 
> r=me, if EWS is satisfied.
> 
> > Source/WebKit/UIProcess/mac/DisplayLink.cpp:101
> > +    RunLoop::main().dispatch([weakPtr = webPageProxy->createWeakPtr()] {
> 
> You should be able to use "weakPtr = makeWeakPtr(*webPageProxy)"

It seems the WebPageProxy class does not have the method weakPtrFactory() which appears to be needed to do this.

Thanks for reviewing!
Comment 5 Per Arne Vollan 2018-06-06 17:21:13 PDT
<rdar://problem/39791647>
Comment 6 WebKit Commit Bot 2018-06-06 17:42:48 PDT
Comment on attachment 342095 [details]
Patch

Clearing flags on attachment: 342095

Committed r232564: <https://trac.webkit.org/changeset/232564>
Comment 7 WebKit Commit Bot 2018-06-06 17:42:49 PDT
All reviewed patches have been landed.  Closing bug.