Merge pull request #9569 from liamwhite/shutdown-wars

qt: additional fixes for reentrant shutdown
This commit is contained in:
Morph 2023-01-09 16:21:27 -05:00 committed by GitHub
commit 3be8312120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1839,9 +1839,11 @@ void GMainWindow::OnEmulationStopTimeExpired() {
void GMainWindow::OnEmulationStopped() { void GMainWindow::OnEmulationStopped() {
shutdown_timer.stop(); shutdown_timer.stop();
emu_thread->disconnect(); if (emu_thread) {
emu_thread->wait(); emu_thread->disconnect();
emu_thread = nullptr; emu_thread->wait();
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();
} }
} }