diff --git a/src/PowderToyFontEditor.cpp b/src/PowderToyFontEditor.cpp index 7b5565473..c6b84b042 100644 --- a/src/PowderToyFontEditor.cpp +++ b/src/PowderToyFontEditor.cpp @@ -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; } diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index 99bc0bd13..1d807e063 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -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; }