From 4b94224955f17b9300daa62eff0fb079b51bf364 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 28 Feb 2020 16:59:41 +1000 Subject: [PATCH] SDL: Use RunLater() for menu actions too --- src/duckstation-sdl/sdl_host_interface.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/duckstation-sdl/sdl_host_interface.cpp b/src/duckstation-sdl/sdl_host_interface.cpp index 2fe2a03ef..726ec308e 100644 --- a/src/duckstation-sdl/sdl_host_interface.cpp +++ b/src/duckstation-sdl/sdl_host_interface.cpp @@ -590,12 +590,12 @@ void SDLHostInterface::DrawMainMenuBar() { if (ImGui::MenuItem("Start Disc", nullptr, false, !system_enabled)) { - DoStartDisc(); + RunLater([this]() { DoStartDisc(); }); ClearImGuiFocus(); } if (ImGui::MenuItem("Start BIOS", nullptr, false, !system_enabled)) { - BootSystemFromBIOS(); + RunLater([this]() { BootSystemFromBIOS(); }); ClearImGuiFocus(); } @@ -603,19 +603,19 @@ void SDLHostInterface::DrawMainMenuBar() if (ImGui::MenuItem("Power Off", nullptr, false, system_enabled)) { - DestroySystem(); + RunLater([this]() { DestroySystem(); }); ClearImGuiFocus(); } if (ImGui::MenuItem("Reset", nullptr, false, system_enabled)) { - ResetSystem(); + RunLater([this]() { ResetSystem(); }); ClearImGuiFocus(); } if (ImGui::MenuItem("Pause", nullptr, m_paused, system_enabled)) { - PauseSystem(!m_paused); + RunLater([this]() { PauseSystem(!m_paused); }); ClearImGuiFocus(); } @@ -623,13 +623,13 @@ void SDLHostInterface::DrawMainMenuBar() if (ImGui::MenuItem("Change Disc", nullptr, false, system_enabled)) { - DoChangeDisc(); + RunLater([this]() { DoChangeDisc(); }); ClearImGuiFocus(); } if (ImGui::MenuItem("Frame Step", nullptr, false, system_enabled)) { - DoFrameStep(); + RunLater([this]() { DoFrameStep(); }); ClearImGuiFocus(); } @@ -643,7 +643,7 @@ void SDLHostInterface::DrawMainMenuBar() std::snprintf(buf, sizeof(buf), "State %u", i); if (ImGui::MenuItem(buf)) { - LoadState(true, i); + RunLater([this, i]() { LoadState(true, i); }); ClearImGuiFocus(); } } @@ -658,7 +658,7 @@ void SDLHostInterface::DrawMainMenuBar() std::snprintf(buf, sizeof(buf), "State %u", i); if (ImGui::MenuItem(buf)) { - SaveState(true, i); + RunLater([this, i]() { SaveState(true, i); }); ClearImGuiFocus(); } }