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
This commit is contained in:
Henrik Rydgård 2023-09-08 15:49:52 +02:00
parent 8dbc1e7354
commit e0c5857927

View File

@ -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(