wayland: Keep EGL window around when hidden
authorBenjamin Otte <otte@redhat.com>
Thu, 13 Apr 2023 02:30:24 +0000 (04:30 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 13 Apr 2023 03:19:18 +0000 (05:19 +0200)
See previous commit:

We want to keep resources around as long as the surface exists.

gdk/wayland/gdksurface-wayland.c

index 7e970f4a733145591b380497a8ae1601702bd335..36aac757b04bd9f61b8986f7fd9bf44d489de6d5 100644 (file)
@@ -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)
     {