[Bug] iOS platform crash if swipe from bottom up and root cause(maybe) #2471
Labels
B - bug
Dang, that shouldn't have happened
DS - ios
F - duplicate
This issue or pull request already exists
Bug and trouble shooting
I've been debugging the crash bug for hours. It was reported by others and had a quick fix by setting ScreenEdge::ALL. Since the crash is reproducible, so I tried to tackle it down or at least find the root cause, I think I got something.
Currently, we create UIWindow first, then run UIApplicationMain, which is problematic, since UIApplicationMain actually setup some global state that UIKit requires, like following
UIGestureEnvironment is also a singleton which is inited and stored inside UIApplication. Also, it is stored in each UIGestureRecognizer instance if it is already created. And UIGestureRecognizer is created when we create UIWindow, which means at that time, the global didn't created, so all the recognizer with
_gestureEnvironment
property as nil.When ScreenEdge preference is 0, it triggers some logic of delay touch handling, and in that code path, it read the property as nil, which crashed when add into a nsarray.
How to fix:
UIWindow/UIView should be created by method on ApplicationDelegate, since UIApplicationMain will never return.
Other
Some evidence (crashed is the bevy_ios_example. good is a normal created ios app):
Crashed
Good call stack
The text was updated successfully, but these errors were encountered: