From c279376cff7285062569b153399137c5bf9b25a0 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 19 Oct 2024 17:05:17 +1000 Subject: [PATCH] Qt: Fix menu creation from incorrect thread --- src/duckstation-qt/mainwindow.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 1fec07fbc..b83ce567b 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1015,22 +1015,22 @@ void MainWindow::populateCheatsMenu(QMenu* menu) if (!System::IsValid()) return; - if (!Cheats::AreCheatsEnabled()) - { - QAction* action = menu->addAction(tr("Cheats are not enabled.")); - action->setEnabled(false); - return; - } - QStringList names; Cheats::EnumerateManualCodes([&names](const std::string& name) { names.append(QString::fromStdString(name)); return true; }); - if (names.empty()) + if (Cheats::AreCheatsEnabled() && names.empty()) return; QtHost::RunOnUIThread([menu, names = std::move(names)]() { + if (names.empty()) + { + QAction* action = menu->addAction(tr("Cheats are not enabled.")); + action->setEnabled(false); + return; + } + QMenu* apply_submenu = menu->addMenu(tr("&Apply Cheat")); for (const QString& name : names) {