mirror of https://github.com/libsdl-org/SDL
Don't unload graphics libraries until after the window has been destroyed.
This fixes creating a window after the first window has been destroyed on Android. The graphics library had been unloaded, so eglDestroySurface() wasn't called, leaving a surface attached to the window, which would prevent attaching new EGL surfaces to the window (eglCreateWindowSurface() would fail with BAD_ALLOC)
This commit is contained in:
parent
69288038ed
commit
b0e7b7db6f
|
@ -3621,12 +3621,18 @@ void SDL_DestroyWindow(SDL_Window *window)
|
|||
}
|
||||
}
|
||||
|
||||
/* make no context current if this is the current context window. */
|
||||
/* Make no context current if this is the current context window */
|
||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||
if (_this->current_glwin == window) {
|
||||
SDL_GL_MakeCurrent(window, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (_this->DestroyWindow) {
|
||||
_this->DestroyWindow(_this, window);
|
||||
}
|
||||
|
||||
/* Unload the graphics libraries after the window is destroyed, which may clean up EGL surfaces */
|
||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||
SDL_GL_UnloadLibrary();
|
||||
}
|
||||
|
@ -3634,10 +3640,6 @@ void SDL_DestroyWindow(SDL_Window *window)
|
|||
SDL_Vulkan_UnloadLibrary();
|
||||
}
|
||||
|
||||
if (_this->DestroyWindow) {
|
||||
_this->DestroyWindow(_this, window);
|
||||
}
|
||||
|
||||
if (_this->grabbed_window == window) {
|
||||
_this->grabbed_window = NULL; /* ungrabbing input. */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue