diff options
-rw-r--r-- | src/libui_sdl/main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 01f67d7..1e91e15 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -1049,6 +1049,12 @@ int EmuThreadFunc(void* burp) return 44203; } +void StopEmuThread() +{ + EmuRunning = 0; + SDL_WaitThread(EmuThread, NULL); +} + void OnAreaDraw(uiAreaHandler* handler, uiArea* area, uiAreaDrawParams* params) { @@ -1856,6 +1862,7 @@ int OnCloseWindow(uiWindow* window, void* blarg) while (EmuStatus != 3); CloseAllDialogs(); + StopEmuThread(); uiQuit(); return 1; } @@ -1893,6 +1900,7 @@ void OnCloseByMenu(uiMenuItem* item, uiWindow* window, void* blarg) while (EmuStatus != 3); CloseAllDialogs(); + StopEmuThread(); DestroyMainWindow(); uiQuit(); } @@ -2691,9 +2699,6 @@ int main(int argc, char** argv) uiMain(); - EmuRunning = 0; - SDL_WaitThread(EmuThread, NULL); - if (Joystick) SDL_JoystickClose(Joystick); if (AudioDevice) SDL_CloseAudioDevice(AudioDevice); if (MicDevice) SDL_CloseAudioDevice(MicDevice); |