mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-08-11 18:50:03 +00:00
Qt: Fix race condition when using cheats
This commit is contained in:
parent
f8c3ddff9a
commit
064b9a6d4d
1 changed files with 6 additions and 2 deletions
|
@ -70,8 +70,6 @@ void CheatEntryWidget::editClicked() {
|
||||||
|
|
||||||
CheatEditDialog::CheatEditDialog(Emulator* emu, CheatEntryWidget& cheatEntry) : QDialog(), emu(emu), cheatEntry(cheatEntry) {
|
CheatEditDialog::CheatEditDialog(Emulator* emu, CheatEntryWidget& cheatEntry) : QDialog(), emu(emu), cheatEntry(cheatEntry) {
|
||||||
setWindowTitle(tr("Edit Cheat"));
|
setWindowTitle(tr("Edit Cheat"));
|
||||||
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
setModal(true);
|
setModal(true);
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout;
|
QVBoxLayout* layout = new QVBoxLayout;
|
||||||
|
@ -147,6 +145,9 @@ void CheatEditDialog::accepted() {
|
||||||
cheatEntry.setMetadata(metadata);
|
cheatEntry.setMetadata(metadata);
|
||||||
cheatEntry.Update();
|
cheatEntry.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete the CheatEditDialog when the main thread is done using it
|
||||||
|
this->deleteLater();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -157,6 +158,9 @@ void CheatEditDialog::rejected() {
|
||||||
// Was adding a cheat but user pressed cancel
|
// Was adding a cheat but user pressed cancel
|
||||||
cheatEntry.Remove();
|
cheatEntry.Remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We have to manually memory-manage the CheatEditDialog object since it's accessed via multiple threads
|
||||||
|
this->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
CheatsWindow::CheatsWindow(Emulator* emu, const std::filesystem::path& cheatPath, QWidget* parent)
|
CheatsWindow::CheatsWindow(Emulator* emu, const std::filesystem::path& cheatPath, QWidget* parent)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue