Open inoutch opened 4 years ago
This problem was reproduced by the example of gfx-rs with some modifications. https://github.com/inoutch/crossplatform_gfx_hal_example/tree/bug-report
[Some modifications] https://github.com/inoutch/crossplatform_gfx_hal_example/commit/27746b0124ebc9e062afc9397d6e3f43d6ab7a01
Device: iPhone X iOS: 13.3.1
I've reported the problem to the winit-rs repository due to the crash caused by the touch event, but if it's a problem on the gfx-rs side, I'll report it to it. Also, if there is any mistake, please point out to me.
Thanks for reporting this! It certainly sounds like an issue here in winit.
It looks like you're using winit 0.21: https://github.com/inoutch/crossplatform_gfx_hal_example/blob/27746b0124ebc9e062afc9397d6e3f43d6ab7a01/rust/game_lib/Cargo.toml#L20
Can you still reproduce this using winit 0.22.2?
Thank you for your quick reply. Update winit-rs version to 0.22.2, and build and run after deleting the target folder, and it still has the same problem. https://github.com/inoutch/crossplatform_gfx_hal_example/commit/4e4cf5d1a2e1ee2a0ab7412c7c5faa76b2744df4#diff-caf063a844fa39631e1a2a0a7b865c12
Hmm. So, it could be entirely unrelated but I've had a similar bug with some of my UIKit WIP for iced. When I start the app and use the UIView to add some subviews, if I tap on the subview before I tap on anything other than a subview, it crashes. So, the work around I've been doing to test that the views are setup correctly is to tap on anything other than say a text box and then tap on the text box... This results in a few touch events and then I can tap on my text input box and do things.
If I tap directly on the input box at first without touching the background view, it crashes with the following stack trace:
2020-06-30 23:06:50.329 ios-example[68349:4586192] *** Assertion failure in -[UIGestureGraphEdge initWithLabel:sourceNode:targetNode:directed:], /Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3920.31.100/Source/GestureGraph/UIGestureGraphEdge.m:24
2020-06-30 23:06:50.366 ios-example[68349:4586192] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: sourceNode'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff258b8bd2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff48805c0f -[UIGestureGraphEdge initWithLabel:sourceNode:targetNode:directed:] + 386
5 UIKitCore 0x00007fff48802662 -[UIGestureGraph addUniqueEdgeWithLabel:sourceNode:targetNode:directed:properties:] + 658
6 UIKitCore 0x00007fff488112d2 -[UIGestureEnvironment _addDynamicRequirementForGestureRecognizer:requiringGestureRecognizerToFail:] + 149
7 UIKitCore 0x00007fff488133f9 _UIGestureEnvironmentUpdate + 967
8 UIKitCore 0x00007fff48812ff4 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 467
9 UIKitCore 0x00007fff48812d7c -[UIGestureEnvironment _updateForEvent:window:] + 225
10 UIKitCore 0x00007fff48cca2fb -[UIWindow sendEvent:] + 4479
11 UIKitCore 0x00007fff48ca4755 -[UIApplication sendEvent:] + 356
12 UIKitCore 0x00007fff48d2f552 __dispatchPreprocessedEventFromEventQueue + 7628
13 UIKitCore 0x00007fff48d32716 __handleEventQueueInternal + 6584
14 UIKitCore 0x00007fff48d28fb9 __handleHIDEventFetcherDrain + 88
15 CoreFoundation 0x00007fff23da0d31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16 CoreFoundation 0x00007fff23da0c5c __CFRunLoopDoSource0 + 76
17 CoreFoundation 0x00007fff23da0434 __CFRunLoopDoSources0 + 180
18 CoreFoundation 0x00007fff23d9b02e __CFRunLoopRun + 974
19 CoreFoundation 0x00007fff23d9a944 CFRunLoopRunSpecific + 404
20 GraphicsServices 0x00007fff38ba6c1a GSEventRunModal + 139
21 UIKitCore 0x00007fff48c8b9ec UIApplicationMain + 1605
22 ios-example 0x0000000105bbf616 _ZN5winit13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17h8a9c32cbfbf0edd9E + 2182
23 ios-example 0x0000000105bd1b8b _ZN5winit10event_loop18EventLoop$LT$T$GT$3run17h0cc7d43eada55386E + 75
24 ios-example 0x0000000105bd2a78 _ZN8iced_ios11application11Application3run17h1329392dead6371aE + 1256
25 ios-example 0x0000000105bb7651 _ZN4iced11application11Application3run17hb9e2e3ffb1788768E + 17
26 ios-example 0x0000000105bb77f1 _ZN4iced7sandbox7Sandbox3run17hc6bdcc433081aff2E + 49
27 ios-example 0x0000000105bc450a _ZN11ios_example4main17h8c33c294d5021811E + 106
28 ios-example 0x0000000105bd18de _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hb99016a139a28815E + 14
29 ios-example 0x0000000105ee4428 _ZN3std9panicking3try7do_call17h53b7a2c20bfe2b9aE + 24
30 ios-example 0x0000000105ee61cb __rust_maybe_catch_panic + 27
31 ios-example 0x0000000105ee4b85 _ZN3std2rt19lang_start_internal17hc274c1ce0c33d6d7E + 149
32 ios-example 0x0000000105bd18c1 _ZN3std2rt10lang_start17h1b4b9e56d8e43005E + 65
33 ios-example 0x0000000105bc4a22 main + 34
34 libdyld.dylib 0x00007fff51a231fd start + 1
35 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
@inoutch thanks for checking. I've succeeded in using your example to reproduce this on my iPhone XR... it's very interesting that this only happens within that area. I'm not able to reproduce this if I comment out all of your rendering code. I'm also not able to reproduce this in my own application, which also uses gfx-hal. I tried adding the fancy UIView
subclassing logic from my application to your example to see if it'd make a difference, but no dice. I'm going to continue to bisect this.
@simlay ah, iOS support in iced would be quite cool! The Original Exception Backtrace I get when reproducing this looks similar to the one you posted, so it seems likely that this is related. Do you have this up in a repo somewhere?
i confirm, I have also received this crash when i tap near when app begins, in top left corner, same exception. using winit 0.24, iced 0.4, and wgpu 0.7
I confirm IOS ScreenEdge Corrected Default #1843 solves my issue with this error (extensively tested and now using my winit fork with that PR applied).
I suspect this is fixed by https://github.com/rust-windowing/winit/pull/3447 and https://github.com/rust-windowing/winit/pull/3826 (we first deprecated, and now disallow creating windows before the application has been initialized).
If I tap on the moment it starts up on iOS, the following error occurs and the app finished.
Xcode wrote the following stack trace for me.
My codes https://github.com/inoutch/tearchan/blob/03edc923569011a0c8e10ac97f1e0e77e5a4574d/src/core/engine.rs#L67-L93
Inexplicably, if I wait for a few seconds after app starting and tap later, it doesn't finish, and it also get the touch event successfully. Also, I use gfx-rs in addition to winit-rs and do present surface or not, an error may or may not occur (This is not related to gfx-rs, and to timing issue?)