Skip to content

Commit

Permalink
Qt: Fix menu creation from incorrect thread
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Oct 19, 2024
1 parent 43ed924 commit c279376
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/duckstation-qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit c279376

Please sign in to comment.