From 75bea01a86a4fb82c29636e8e86f4e30c551a65a Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 13 Apr 2023 04:30:24 +0200 Subject: [PATCH] wayland: Keep EGL window around when hidden See previous commit: We want to keep resources around as long as the surface exists. --- gdk/wayland/gdksurface-wayland.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 7e970f4a73..36aac757b0 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -817,6 +817,12 @@ gdk_wayland_surface_create_wl_surface (GdkSurface *surface) static void gdk_wayland_surface_destroy_wl_surface (GdkWaylandSurface *self) { + if (self->display_server.egl_window) + { + gdk_surface_set_egl_native_window (GDK_SURFACE (self), NULL); + g_clear_pointer (&self->display_server.egl_window, wl_egl_window_destroy); + } + g_clear_pointer (&self->display_server.viewport, wp_viewport_destroy); g_clear_pointer (&self->display_server.fractional_scale, wp_fractional_scale_v1_destroy); @@ -1053,13 +1059,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface) unmap_popups_for_surface (surface); - if (impl->display_server.egl_window) - { - gdk_surface_set_egl_native_window (surface, NULL); - wl_egl_window_destroy (impl->display_server.egl_window); - impl->display_server.egl_window = NULL; - } - impl->awaiting_frame = FALSE; if (impl->awaiting_frame_frozen) { -- 2.30.2