mirror of https://github.com/godotengine/godot
Fix a crash in Joypad initialization on iOS
Creating a JoypadApple can trigger a notification to add a joypad (if a device is already connected before the game is started). Observed on iOS 18.2.1 with a Nimbus SteelSeries. However at this point the Input singleton is not available yet, so it will crash. This commit moves JoypadApple initialization to `initialize_joypad()` which is called explicitly after the Input singleton is available. This is consistent with other platform joypad initialization.
This commit is contained in:
parent
9ee1873ae1
commit
e77a011188
|
|
@ -65,8 +65,7 @@ private:
|
|||
virtual void initialize_core() override;
|
||||
virtual void initialize() override;
|
||||
|
||||
virtual void initialize_joypads() override {
|
||||
}
|
||||
virtual void initialize_joypads() override;
|
||||
|
||||
virtual void set_main_loop(MainLoop *p_main_loop) override;
|
||||
virtual MainLoop *get_main_loop() const override;
|
||||
|
|
|
|||
|
|
@ -126,11 +126,13 @@ void OS_IOS::initialize() {
|
|||
initialize_core();
|
||||
}
|
||||
|
||||
void OS_IOS::initialize_joypads() {
|
||||
joypad_apple = memnew(JoypadApple);
|
||||
}
|
||||
|
||||
void OS_IOS::initialize_modules() {
|
||||
ios = memnew(iOS);
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", ios));
|
||||
|
||||
joypad_apple = memnew(JoypadApple);
|
||||
}
|
||||
|
||||
void OS_IOS::deinitialize_modules() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue