qt: additional fixes for reentrant shutdown

This commit is contained in:
Liam 2023-01-06 18:50:01 -05:00
parent 7ef897a277
commit 9ed4c13758
1 changed files with 7 additions and 3 deletions

View File

@ -1839,9 +1839,11 @@ void GMainWindow::OnEmulationStopTimeExpired() {
void GMainWindow::OnEmulationStopped() { void GMainWindow::OnEmulationStopped() {
shutdown_timer.stop(); shutdown_timer.stop();
if (emu_thread) {
emu_thread->disconnect(); emu_thread->disconnect();
emu_thread->wait(); emu_thread->wait();
emu_thread = nullptr; emu_thread.reset();
}
if (shutdown_dialog) { if (shutdown_dialog) {
shutdown_dialog->deleteLater(); shutdown_dialog->deleteLater();
@ -3029,6 +3031,8 @@ void GMainWindow::OnStopGame() {
if (OnShutdownBegin()) { if (OnShutdownBegin()) {
OnShutdownBeginDialog(); OnShutdownBeginDialog();
} else {
OnEmulationStopped();
} }
} }