[UI] Shuffle some exit handling code around

This commit is contained in:
DrChat 2017-12-17 12:37:58 -06:00
parent 39b5d8ba42
commit 8ec8d9778f
3 changed files with 3 additions and 8 deletions

View File

@ -75,10 +75,6 @@ bool EmulatorWindow::Initialize() {
window_->on_closed.AddListener([this](UIEvent* e) { window_->on_closed.AddListener([this](UIEvent* e) {
loop_->Quit(); loop_->Quit();
// TODO(benvanik): proper exit.
XELOGI("User-initiated death!");
exit(1);
}); });
loop_->on_quit.AddListener([this](UIEvent* e) { window_.reset(); }); loop_->on_quit.AddListener([this](UIEvent* e) { window_.reset(); });

View File

@ -178,6 +178,9 @@ int xenia_main(const std::vector<std::wstring>& args) {
emulator_window->loop()->on_quit.AddListener([&](ui::UIEvent* e) { emulator_window->loop()->on_quit.AddListener([&](ui::UIEvent* e) {
exiting = true; exiting = true;
evt->Set(); evt->Set();
XELOGI("Cheap-skate exit!");
exit(0);
}); });
// Enable the main menu now that the emulator is properly loaded // Enable the main menu now that the emulator is properly loaded

View File

@ -169,7 +169,6 @@ void Win32Window::OnDestroy() { super::OnDestroy(); }
void Win32Window::OnClose() { void Win32Window::OnClose() {
if (!closing_ && hwnd_) { if (!closing_ && hwnd_) {
closing_ = true; closing_ = true;
CloseWindow(hwnd_);
} }
super::OnClose(); super::OnClose();
} }
@ -428,7 +427,6 @@ void Win32Window::Close() {
return; return;
} }
closing_ = true; closing_ = true;
Close();
OnClose(); OnClose();
DestroyWindow(hwnd_); DestroyWindow(hwnd_);
} }
@ -509,8 +507,6 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
OnDestroy(); OnDestroy();
break; break;
case WM_CLOSE: case WM_CLOSE:
closing_ = true;
Close();
OnClose(); OnClose();
break; break;