Skip to content

Commit

Permalink
fix OpenGL deinit when closing emu
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Jun 25, 2019
1 parent 1d8902c commit 4d775dc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/libui_sdl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -1856,6 +1862,7 @@ int OnCloseWindow(uiWindow* window, void* blarg)
while (EmuStatus != 3);

CloseAllDialogs();
StopEmuThread();
uiQuit();
return 1;
}
Expand Down Expand Up @@ -1893,6 +1900,7 @@ void OnCloseByMenu(uiMenuItem* item, uiWindow* window, void* blarg)
while (EmuStatus != 3);

CloseAllDialogs();
StopEmuThread();
DestroyMainWindow();
uiQuit();
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4d775dc

Please sign in to comment.