OatmealDome / dolphin-ios

Dolphin for iOS, reborn
Other
278 stars 30 forks source link

Crash when attempting to clear the CAMetalLayer after emulation stop #32

Closed OatmealDome closed 1 year ago

OatmealDome commented 1 year ago

Crash report from brand:

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib                 0x1d3cbe200 __pthread_kill + 8
1   libsystem_pthread.dylib                0x1e3efb1ac pthread_kill + 268
2   libsystem_c.dylib                      0x19eab5ca0 abort + 180
3   libsystem_c.dylib                      0x19eb0c890 __assert_rtn + 272
4   Metal                                  0x1924bef00 MTLReportFailure.cold.1 + 48
5   Metal                                  0x19249d7c8 MTLReportFailure + 464
6   Metal                                  0x1923bcb44 -[_MTLCommandBuffer presentDrawable:] + 452
7   DolphiniOS                             0x102632fa8 -[EmulationCoordinator clearMetalLayer] + 472
8   DolphiniOS                             0x1026369d8 __58-[EmulationViewController receiveEmulationEndNotification]_block_invoke_2 + 100
9   UIKitCore                              0x1999d7fa0 -[UIPresentationController transitionDidFinish:] + 1120
10  UIKitCore                              0x1998ab8d4 -[_UICurrentContextPresentationController transitionDidFinish:] + 44
11  UIKitCore                              0x199ebc4f0 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.101 + 136
12  UIKitCore                              0x199a1185c -[_UIViewControllerTransitionContext completeTransition:] + 116
13  UIKitCore                              0x199a129c8 -[UITransitionView notifyDidCompleteTransition:] + 180
14  UIKitCore                              0x199a125c8 -[UITransitionView _didCompleteTransition:] + 828
15  UIKitCore                              0x19a77f1b0 __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 36
16  UIKitCore                              0x19982c114 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 636
17  UIKitCore                              0x19982b070 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 436
18  UIKitCore                              0x19982a790 -[UIViewAnimationState animationDidStop:finished:] + 196
19  UIKitCore                              0x19982a8a4 -[UIViewAnimationState animationDidStop:finished:] + 472
20  QuartzCore                             0x198c44ae8 CA::Layer::run_animation_callbacks(void*) + 232
21  libdispatch.dylib                      0x19ea51fdc _dispatch_client_callout + 20
22  libdispatch.dylib                      0x19ea607f4 _dispatch_main_queue_drain + 928
23  libdispatch.dylib                      0x19ea60444 _dispatch_main_queue_callback_4CF + 44
24  CoreFoundation                         0x197666a08 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
25  CoreFoundation                         0x197648368 __CFRunLoopRun + 2036
26  CoreFoundation                         0x19764d1e4 CFRunLoopRunSpecific + 612
27  GraphicsServices                       0x1d046d368 GSEventRunModal + 164
28  UIKitCore                              0x199afcd88 -[UIApplication _run] + 888
29  UIKitCore                              0x199afc9ec UIApplicationMain + 340
30  DolphiniOS                             0x10262eb98 main + 144
31  dyld                                   0x1b5971948 start + 2504
OatmealDome commented 1 year ago

Fixed an issue where the clear code would get called multiple times due to multiple observer registration in NSNotificationCenter. I also adjusted the code to clear the layer before dismissing the view controller.

Let's see if the issue reappears in the next beta.

Simonx22 commented 1 year ago

Is this fixed?

OatmealDome commented 1 year ago

Going to assume fixed. If I see it occur again, I'll reopen this issue.