From e0c5857927ae73483df5b0fdc4ed33c9e51bd6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 8 Sep 2023 15:49:52 +0200 Subject: [PATCH] Tilt analog settings: Fix failure to reinitialize tilt_ when creating views. This caused crashes due to tilt_ ending up pointing to a deleted object after recreate instead of null (in which case we would have avoided the writes). Fixes #18105 --- UI/TiltAnalogSettingsScreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/TiltAnalogSettingsScreen.cpp b/UI/TiltAnalogSettingsScreen.cpp index f4b9234f80..716baf5289 100644 --- a/UI/TiltAnalogSettingsScreen.cpp +++ b/UI/TiltAnalogSettingsScreen.cpp @@ -54,6 +54,7 @@ void TiltAnalogSettingsScreen::CreateViews() { tilt_ = new JoystickHistoryView(StickHistoryViewType::OTHER, "", new LinearLayoutParams(1.0f)); root_->Add(tilt_); } else { + tilt_ = nullptr; AnchorLayout *rightSide = new AnchorLayout(new LinearLayoutParams(1.0)); root_->Add(rightSide); switch (g_Config.iTiltInputType) { @@ -99,7 +100,6 @@ void TiltAnalogSettingsScreen::CreateViews() { settings->SetSpacing(0); - static const char *tiltTypes[] = { "None (Disabled)", "Analog Stick", "D-PAD", "PSP Action Buttons", "L/R Trigger Buttons" }; settings->Add(new ItemHeader(co->T("Tilt control setup"))); settings->Add(new PopupMultiChoice(&g_Config.iTiltInputType, co->T("Tilt Input Type"), tiltTypes, 0, ARRAY_SIZE(tiltTypes), I18NCat::CONTROLS, screenManager()))->OnChoice.Add(