mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 14:43:20 +00:00
video: Unload GL/Vulkan when shutting down the video subsystem
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.
This commit is contained in:
parent
b14aceea51
commit
37fca1fdcf
1 changed files with 10 additions and 0 deletions
|
|
@ -4667,6 +4667,16 @@ void SDL_VideoQuit(void)
|
|||
while (_this->windows) {
|
||||
SDL_DestroyWindow(_this->windows);
|
||||
}
|
||||
|
||||
if (_this->gl_config.driver_loaded && _this->GL_UnloadLibrary) {
|
||||
_this->GL_UnloadLibrary(_this);
|
||||
_this->gl_config.driver_loaded = 0;
|
||||
}
|
||||
if (_this->vulkan_config.loader_loaded && _this->Vulkan_UnloadLibrary) {
|
||||
_this->Vulkan_UnloadLibrary(_this);
|
||||
_this->vulkan_config.loader_loaded = 0;
|
||||
}
|
||||
|
||||
_this->VideoQuit(_this);
|
||||
|
||||
for (i = _this->num_displays; i--; ) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue