mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 20:12:50 +02:00
Fix crash on exit when using nvidia-460 + SDL with EGL support
This commit is contained in:
@@ -515,6 +515,17 @@ int main(int argc, char * argv[])
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
delete gameController;
|
||||
delete ui::Engine::Ref().g;
|
||||
if (SDL_GetWindowFlags(sdl_window) & SDL_WINDOW_OPENGL)
|
||||
{
|
||||
// * nvidia-460 egl registers callbacks with x11 that end up being called
|
||||
// after egl is unloaded unless we grab it here and release it after
|
||||
// sdl closes the display. this is an nvidia driver weirdness but
|
||||
// technically an sdl bug. glfw has this fixed:
|
||||
// https://github.com/glfw/glfw/commit/9e6c0c747be838d1f3dc38c2924a47a42416c081
|
||||
SDL_GL_LoadLibrary(NULL);
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_GL_UnloadLibrary();
|
||||
}
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1000,6 +1000,17 @@ int main(int argc, char * argv[])
|
||||
delete gameController;
|
||||
delete ui::Engine::Ref().g;
|
||||
Client::Ref().Shutdown();
|
||||
if (SDL_GetWindowFlags(sdl_window) & SDL_WINDOW_OPENGL)
|
||||
{
|
||||
// * nvidia-460 egl registers callbacks with x11 that end up being called
|
||||
// after egl is unloaded unless we grab it here and release it after
|
||||
// sdl closes the display. this is an nvidia driver weirdness but
|
||||
// technically an sdl bug. glfw has this fixed:
|
||||
// https://github.com/glfw/glfw/commit/9e6c0c747be838d1f3dc38c2924a47a42416c081
|
||||
SDL_GL_LoadLibrary(NULL);
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_GL_UnloadLibrary();
|
||||
}
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user