Don't show multiple exit confirmation dialogues.

Pause emulation while waiting for confirmation to exit.

Fixes issue 5822.
This commit is contained in:
rog 2012-12-28 03:29:51 -05:00
parent 225d29f3f6
commit af2820ac88

View File

@ -96,6 +96,8 @@ extern "C" {
#include "../resources/KDE.h"
};
bool confirmStop = false;
// Create menu items
// ---------------------
void CFrame::CreateMenu()
@ -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)
@ -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?"),
@ -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