aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-06-25 17:37:32 +0200
committerArisotura <thetotalworm@gmail.com>2019-06-25 17:37:32 +0200
commit4d775dcf8578c0ded92d39917a2a60c70e248e70 (patch)
treefb70af5ce441df20659724c3513e15e37afcd573
parent1d8902c631da44756d80db1bb303dba3aab19dea (diff)
fix OpenGL deinit when closing emu
-rw-r--r--src/libui_sdl/main.cpp11
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);