summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2014-06-20 03:03:00 +0200
committerJules Blok <jules.blok@gmail.com>2014-07-08 21:21:24 +0200
commitb30d5dccbe46c4bf9977a1437a826d082abebee0 (patch)
tree8edaed412d98daddeb5cbe8fe32897dd415e0e23 /Source
parent3266394dfbb564f69e3cd6470ad608a4db314916 (diff)
Frame: OnClose now handles asynchronous behaviour of DoStop().
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/Frame.cpp13
-rw-r--r--Source/Core/DolphinWX/Frame.h1
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp17
3 files changed, 21 insertions, 10 deletions
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 1807c5e53b..38b8ae7df0 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -352,7 +352,7 @@ CFrame::CFrame(wxFrame* parent,
, m_LogWindow(nullptr), m_LogConfigWindow(nullptr)
, m_FifoPlayerDlg(nullptr), UseDebugger(_UseDebugger)
, m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
- , m_bGameLoading(false)
+ , m_bGameLoading(false), m_bClosing(false)
{
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
bFloatWindow[i] = false;
@@ -536,15 +536,18 @@ void CFrame::OnActive(wxActivateEvent& event)
void CFrame::OnClose(wxCloseEvent& event)
{
+ m_bClosing = true;
+
+ // Before closing the window we need to shut down the emulation core.
+ // We'll try to close this window again once that is done.
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
DoStop();
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
- return;
- UpdateGUI();
+ event.Veto();
+ return;
}
- //Stop Dolphin from saving the minimized Xpos and Ypos
+ // Stop Dolphin from saving the minimized Xpos and Ypos
if (main_frame->IsIconized())
main_frame->Iconize(false);
diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h
index e32b91f918..27f88690c9 100644
--- a/Source/Core/DolphinWX/Frame.h
+++ b/Source/Core/DolphinWX/Frame.h
@@ -186,6 +186,7 @@ private:
bool m_bTabSplit;
bool m_bNoDocking;
bool m_bGameLoading;
+ bool m_bClosing;
std::vector<std::string> drives;
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 7c72aad691..6fb0f0106a 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -832,9 +832,16 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
void CFrame::OnRenderParentClose(wxCloseEvent& event)
{
- DoStop();
- if (Core::GetState() == Core::CORE_UNINITIALIZED)
- event.Skip();
+ // Before closing the window we need to shut down the emulation core.
+ // We'll try to close this window again once that is done.
+ if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ {
+ DoStop();
+ event.Veto();
+ return;
+ }
+
+ event.Skip();
}
void CFrame::OnRenderParentMove(wxMoveEvent& event)
@@ -1177,8 +1184,8 @@ void CFrame::OnStopped()
// Clear wiimote connection status from the status bar.
GetStatusBar()->SetStatusText(" ", 1);
- // If batch mode was specified on the command-line, exit now.
- if (m_bBatchMode)
+ // If batch mode was specified on the command-line or we were already closing, exit now.
+ if (m_bBatchMode || m_bClosing)
Close(true);
// If using auto size with render to main, reset the application size.