mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 14:55:39 +00:00
SDL_video: defer destroying window until GL/EGL/Vulkan unloaded
This commit is contained in:
@@ -1904,16 +1904,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||
window->surface_valid = SDL_FALSE;
|
||||
}
|
||||
|
||||
if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */
|
||||
if (_this->DestroyWindowFramebuffer) {
|
||||
_this->DestroyWindowFramebuffer(_this, window);
|
||||
}
|
||||
}
|
||||
|
||||
if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
||||
_this->DestroyWindow(_this, window);
|
||||
}
|
||||
|
||||
if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
|
||||
if (flags & SDL_WINDOW_OPENGL) {
|
||||
need_gl_load = SDL_TRUE;
|
||||
@@ -1956,6 +1946,16 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||
SDL_Vulkan_UnloadLibrary();
|
||||
}
|
||||
|
||||
if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */
|
||||
if (_this->DestroyWindowFramebuffer) {
|
||||
_this->DestroyWindowFramebuffer(_this, window);
|
||||
}
|
||||
}
|
||||
|
||||
if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
||||
_this->DestroyWindow(_this, window);
|
||||
}
|
||||
|
||||
if (need_gl_load) {
|
||||
if (SDL_GL_LoadLibrary(NULL) < 0) {
|
||||
return -1;
|
||||
@@ -3297,6 +3297,12 @@ SDL_DestroyWindow(SDL_Window * window)
|
||||
window->surface = NULL;
|
||||
window->surface_valid = SDL_FALSE;
|
||||
}
|
||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||
SDL_GL_UnloadLibrary();
|
||||
}
|
||||
if (window->flags & SDL_WINDOW_VULKAN) {
|
||||
SDL_Vulkan_UnloadLibrary();
|
||||
}
|
||||
if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */
|
||||
if (_this->DestroyWindowFramebuffer) {
|
||||
_this->DestroyWindowFramebuffer(_this, window);
|
||||
@@ -3305,12 +3311,6 @@ SDL_DestroyWindow(SDL_Window * window)
|
||||
if (_this->DestroyWindow) {
|
||||
_this->DestroyWindow(_this, window);
|
||||
}
|
||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||
SDL_GL_UnloadLibrary();
|
||||
}
|
||||
if (window->flags & SDL_WINDOW_VULKAN) {
|
||||
SDL_Vulkan_UnloadLibrary();
|
||||
}
|
||||
|
||||
display = SDL_GetDisplayForWindow(window);
|
||||
if (display->fullscreen_window == window) {
|
||||
|
||||
Reference in New Issue
Block a user