diff options
author | Liam <byteslice@airmail.cc> | 2022-12-24 17:31:34 -0500 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-12-24 17:31:34 -0500 |
commit | cb7f0c2ec367ae8b480cf9ca7b1e3df6a4d0425e (patch) | |
tree | ee30246618bba61a84a6ad0f7bf8784f8c8d6797 /src/yuzu/main.cpp | |
parent | c86e21abe422c3b424f4853e497932cdff5778e0 (diff) |
qt: prevent reentrant shutdown
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 6121711e03..524650144f 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1785,9 +1785,9 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t OnStartGame(); } -void GMainWindow::OnShutdownBegin() { +bool GMainWindow::OnShutdownBegin() { if (!emulation_running) { - return; + return false; } if (ui->action_Fullscreen->isChecked()) { @@ -1799,6 +1799,10 @@ void GMainWindow::OnShutdownBegin() { // Disable unlimited frame rate Settings::values.use_speed_limit.SetValue(true); + if (system->IsShuttingDown()) { + return false; + } + system->SetShuttingDown(true); discord_rpc->Pause(); @@ -1817,6 +1821,8 @@ void GMainWindow::OnShutdownBegin() { ui->action_Pause->setEnabled(false); ui->action_Restart->setEnabled(false); ui->action_Stop->setEnabled(false); + + return true; } void GMainWindow::OnShutdownBeginDialog() { @@ -3003,8 +3009,9 @@ void GMainWindow::OnStopGame() { return; } - OnShutdownBegin(); - OnShutdownBeginDialog(); + if (OnShutdownBegin()) { + OnShutdownBeginDialog(); + } } void GMainWindow::OnLoadComplete() { |