video: Ensure that all references to a destroyed fullscreen window are removed
Windowing systems that receive fullscreen state changes asynchronously may not receive a configure event notifying SDL that the window has left fullscreen when the window is being destroyed. Ensure that no display holds a reference to a destroyed fullscreen window.main
parent
f2695856d6
commit
310f21bf84
|
@ -3651,6 +3651,13 @@ void SDL_DestroyWindow(SDL_Window *window)
|
|||
SDL_HideWindow(window);
|
||||
}
|
||||
|
||||
/* Make sure the destroyed window isn't referenced by any display as a fullscreen window. */
|
||||
for (int i = 0; i < _this->num_displays; ++i) {
|
||||
if (_this->displays[i]->fullscreen_window == window) {
|
||||
_this->displays[i]->fullscreen_window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure this window no longer has focus */
|
||||
if (SDL_GetKeyboardFocus() == window) {
|
||||
SDL_SetKeyboardFocus(NULL);
|
||||
|
|
|
@ -2518,6 +2518,12 @@ void Wayland_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|||
SDL_VideoData *data = _this->driverdata;
|
||||
SDL_WindowData *wind = window->driverdata;
|
||||
|
||||
/* Roundtrip before destroying the window to make sure that it has received input leave events, so that
|
||||
* no internal structures are left pointing to the destroyed window. */
|
||||
if (wind->show_hide_sync_required) {
|
||||
WAYLAND_wl_display_roundtrip(data->display);
|
||||
}
|
||||
|
||||
if (data && wind) {
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
if (wind->egl_surface) {
|
||||
|
|
Loading…
Reference in New Issue