Skip to content

Conversation

@Kontrabant
Copy link
Contributor

@Kontrabant Kontrabant commented Dec 21, 2025

If GL/Vulkan was loaded manually via a SDL_X_LoadLibrary() call instead of via window flags or through the GPU or renderer system, and there is no matching SDL_X_UnloadLibrary() call, the library instance won't be automatically unloaded while shutting down the video system, as the refcount won't go to zero, which can cause problems with some backends, and leaves a leaked DLL/SO handle when the global video object is destroyed.

Ensure that the libraries are unloaded after destroying the windows, but before shutting down the video backend, to prevent a leak and possible driver errors when shutting down the video backend.

In particular, Nvidia's egl-wayland2 library has issues when closing the Wayland connection without calling eglTerminate first. See NVIDIA/egl-wayland2#27. They're patching around it, but SDL should be cleaning this up itself.

@Kontrabant Kontrabant added this to the 3.2.30 milestone Dec 21, 2025
@Kontrabant Kontrabant force-pushed the glvk_shutdown branch 2 times, most recently from 79d51e4 to 95ec421 Compare December 21, 2025 17:07
If GL/Vulkan was loaded manually via a SDL_X_LoadLibrary() call instead of via window flags or through the GPU or renderer system, and there is no matching SDL_X_UnloadLibrary() call, the library instance won't be automatically unloaded while shutting down the video system, as the refcount won't go to zero, which can cause problems with some backends, and leaves a leaked DLL/SO handle when the global video object is destroyed.

Ensure that the libraries are unloaded after destroying the windows, but before shutting down the video backend, to prevent a leak and possible driver errors when shutting down the video backend.
@Kontrabant Kontrabant merged commit 37fca1f into libsdl-org:main Dec 21, 2025
43 checks passed
@Kontrabant Kontrabant deleted the glvk_shutdown branch December 21, 2025 17:44
@Kontrabant
Copy link
Contributor Author

Cherry-picked as a bug fix as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant