Qt: Fix menu creation from incorrect thread
This commit is contained in:
parent
43ed92415d
commit
c279376cff
|
@ -1015,22 +1015,22 @@ void MainWindow::populateCheatsMenu(QMenu* menu)
|
||||||
if (!System::IsValid())
|
if (!System::IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Cheats::AreCheatsEnabled())
|
|
||||||
{
|
|
||||||
QAction* action = menu->addAction(tr("Cheats are not enabled."));
|
|
||||||
action->setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList names;
|
QStringList names;
|
||||||
Cheats::EnumerateManualCodes([&names](const std::string& name) {
|
Cheats::EnumerateManualCodes([&names](const std::string& name) {
|
||||||
names.append(QString::fromStdString(name));
|
names.append(QString::fromStdString(name));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (names.empty())
|
if (Cheats::AreCheatsEnabled() && names.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QtHost::RunOnUIThread([menu, names = std::move(names)]() {
|
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"));
|
QMenu* apply_submenu = menu->addMenu(tr("&Apply Cheat"));
|
||||||
for (const QString& name : names)
|
for (const QString& name : names)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue