Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't show multiple exit confirmation dialogues.
Pause emulation while waiting for confirmation to exit.

Fixes issue 5822.
  • Loading branch information
rog9 committed Dec 28, 2012
1 parent 225d29f commit af2820a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/Core/DolphinWX/Src/FrameTools.cpp
Expand Up @@ -96,6 +96,8 @@ extern "C" {
#include "../resources/KDE.h"
};

bool confirmStop = false;

// Create menu items
// ---------------------
void CFrame::CreateMenu()
Expand Down Expand Up @@ -1070,6 +1072,9 @@ void CFrame::DoPause()
// Stop the emulation
void CFrame::DoStop()
{
if (confirmStop)
return;

m_bGameLoading = false;
if (Core::GetState() != Core::CORE_UNINITIALIZED ||
m_RenderParent != NULL)
Expand All @@ -1082,6 +1087,9 @@ void CFrame::DoStop()
// Ask for confirmation in case the user accidentally clicked Stop / Escape
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{
Core::EState state = Core::GetState();
confirmStop = true;
Core::SetState(Core::CORE_PAUSE);
wxMessageDialog *m_StopDlg = new wxMessageDialog(
this,
_("Do you want to stop the current emulation?"),
Expand All @@ -1091,8 +1099,12 @@ void CFrame::DoStop()

int Ret = m_StopDlg->ShowModal();
m_StopDlg->Destroy();
confirmStop = false;
if (Ret != wxID_YES)
{
Core::SetState(state);
return;
}
}

// TODO: Show the author/description dialog here
Expand Down

0 comments on commit af2820a

Please sign in to comment.