From 891242920e785f01f758629c7bbd5cf263219476 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 13 Apr 2023 02:56:12 +0200 Subject: [PATCH] wayland: Split out a function We have a create_wl_surface(), create a matching destroy_wl_surface(). --- gdk/wayland/gdksurface-wayland.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 8dfd9531db..22dede3cf4 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -910,6 +910,17 @@ gdk_wayland_surface_create_wl_surface (GdkSurface *surface) self->display_server.wl_surface = wl_surface; } +static void +gdk_wayland_surface_destroy_wl_surface (GdkWaylandSurface *self) +{ + g_clear_pointer (&self->display_server.viewport, wp_viewport_destroy); + g_clear_pointer (&self->display_server.fractional_scale, wp_fractional_scale_v1_destroy); + + g_clear_pointer (&self->display_server.wl_surface, wl_surface_destroy); + + g_clear_pointer (&self->display_server.outputs, g_slist_free); +} + static void maybe_notify_mapped (GdkSurface *surface) { @@ -1075,13 +1086,7 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface) impl->initial_configure_received = FALSE; } - g_clear_pointer (&impl->display_server.fractional_scale, wp_fractional_scale_v1_destroy); - g_clear_pointer (&impl->display_server.viewport, wp_viewport_destroy); - - g_clear_pointer (&impl->display_server.wl_surface, wl_surface_destroy); - - g_slist_free (impl->display_server.outputs); - impl->display_server.outputs = NULL; + gdk_wayland_surface_destroy_wl_surface (impl); } impl->has_uncommitted_ack_configure = FALSE;