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" #include "../resources/KDE.h"
}; };
bool confirmStop = false;
// Create menu items // Create menu items
// --------------------- // ---------------------
void CFrame::CreateMenu() void CFrame::CreateMenu()
@ -1070,6 +1072,9 @@ void CFrame::DoPause()
// Stop the emulation // Stop the emulation
void CFrame::DoStop() void CFrame::DoStop()
{ {
if (confirmStop)
return;
m_bGameLoading = false; m_bGameLoading = false;
if (Core::GetState() != Core::CORE_UNINITIALIZED || if (Core::GetState() != Core::CORE_UNINITIALIZED ||
m_RenderParent != NULL) m_RenderParent != NULL)
@ -1082,6 +1087,9 @@ void CFrame::DoStop()
// Ask for confirmation in case the user accidentally clicked Stop / Escape // Ask for confirmation in case the user accidentally clicked Stop / Escape
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{ {
Core::EState state = Core::GetState();
confirmStop = true;
Core::SetState(Core::CORE_PAUSE);
wxMessageDialog *m_StopDlg = new wxMessageDialog( wxMessageDialog *m_StopDlg = new wxMessageDialog(
this, this,
_("Do you want to stop the current emulation?"), _("Do you want to stop the current emulation?"),
@ -1091,8 +1099,12 @@ void CFrame::DoStop()
int Ret = m_StopDlg->ShowModal(); int Ret = m_StopDlg->ShowModal();
m_StopDlg->Destroy(); m_StopDlg->Destroy();
confirmStop = false;
if (Ret != wxID_YES) if (Ret != wxID_YES)
{
Core::SetState(state);
return; return;
}
} }
// TODO: Show the author/description dialog here // TODO: Show the author/description dialog here