From 427ce8dcef89939ba6a6392e11af83809c539e07 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Fri, 15 Oct 2021 16:41:29 -0400 Subject: ui: fix crash when closing configure window This crash happens 100% of the time (on Linux at least), you just need to open the configure window and click OK. It seems to happen when the tabs are destroyed and once all the tabs are destroyed, a final signal is sent with `index == -1`. So `debug_tab_tab` doesn't exist anymore when this happens, so the crash. --- src/yuzu/configuration/configure_dialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 759625ef7..cf269f5d1 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -81,8 +81,11 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, SetConfiguration(); PopulateSelectionList(); - connect(ui->tabWidget, &QTabWidget::currentChanged, this, - [this]() { debug_tab_tab->SetCurrentIndex(0); }); + connect(ui->tabWidget, &QTabWidget::currentChanged, this, [this](int index) { + if (index != -1) { + debug_tab_tab->SetCurrentIndex(0); + } + }); connect(ui_tab.get(), &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged); connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, &ConfigureDialog::UpdateVisibleTabs); -- cgit v1.2.3