From: Matthias Clasen Date: Mon, 5 Jun 2023 22:05:27 +0000 (-0400) Subject: wayland: Free seat globals in dispose X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~179^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=51f4ad55cfdc80f0125430ea58c551bdfc9a8af1;p=gtk4.git wayland: Free seat globals in dispose This matches what we do for the display globals. --- diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 617d67e556..95c5fa7803 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -698,8 +698,8 @@ gdk_wayland_display_dispose (GObject *object) g_list_free_full (display_wayland->on_has_globals_closures, g_free); + g_clear_pointer (&display_wayland->cursor_theme, wl_cursor_theme_destroy); g_clear_pointer (&display_wayland->compositor, wl_compositor_destroy); - g_clear_pointer (&display_wayland->shm, wl_shm_destroy); g_clear_pointer (&display_wayland->xdg_wm_base, xdg_wm_base_destroy); g_clear_pointer (&display_wayland->zxdg_shell_v6, zxdg_shell_v6_destroy); g_clear_pointer (&display_wayland->gtk_shell, gtk_shell1_destroy); @@ -720,11 +720,14 @@ gdk_wayland_display_dispose (GObject *object) g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy); g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy); + g_clear_pointer (&display_wayland->shm, wl_shm_destroy); g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy); - g_clear_pointer (&display_wayland->wl_display, wl_display_disconnect); + g_list_store_remove_all (display_wayland->monitors); G_OBJECT_CLASS (gdk_wayland_display_parent_class)->dispose (object); + + g_clear_pointer (&display_wayland->wl_display, wl_display_disconnect); } static void @@ -734,22 +737,17 @@ gdk_wayland_display_finalize (GObject *object) _gdk_wayland_display_finalize_cursors (display_wayland); + g_object_unref (display_wayland->monitors); + g_free (display_wayland->startup_notification_id); g_free (display_wayland->cursor_theme_name); xkb_context_unref (display_wayland->xkb_context); - g_clear_pointer (&display_wayland->cursor_theme, wl_cursor_theme_destroy); - - g_list_store_remove_all (display_wayland->monitors); - g_object_unref (display_wayland->monitors); - if (display_wayland->settings) g_hash_table_destroy (display_wayland->settings); g_clear_object (&display_wayland->settings_portal); - wl_display_disconnect (display_wayland->wl_display); - G_OBJECT_CLASS (gdk_wayland_display_parent_class)->finalize (object); } diff --git a/gdk/wayland/gdkseat-wayland.c b/gdk/wayland/gdkseat-wayland.c index dcef036ea9..061a13cbc5 100644 --- a/gdk/wayland/gdkseat-wayland.c +++ b/gdk/wayland/gdkseat-wayland.c @@ -3875,6 +3875,23 @@ gdk_wayland_pointer_data_finalize (GdkWaylandPointerData *pointer) g_slist_free (pointer->pointer_surface_outputs); } +static void +gdk_wayland_seat_dispose (GObject *object) +{ + GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (object); + + g_clear_pointer (&seat->wl_seat, wl_seat_destroy); + g_clear_pointer (&seat->wl_pointer, wl_pointer_destroy); + g_clear_pointer (&seat->wl_keyboard, wl_keyboard_destroy); + g_clear_pointer (&seat->wl_touch, wl_touch_destroy); + g_clear_pointer (&seat->wp_pointer_gesture_swipe, zwp_pointer_gesture_swipe_v1_destroy); + g_clear_pointer (&seat->wp_pointer_gesture_pinch, zwp_pointer_gesture_pinch_v1_destroy); + g_clear_pointer (&seat->wp_pointer_gesture_hold, zwp_pointer_gesture_hold_v1_destroy); + g_clear_pointer (&seat->wp_tablet_seat, zwp_tablet_seat_v2_destroy); + + G_OBJECT_CLASS (gdk_wayland_seat_parent_class)->dispose (object); +} + static void gdk_wayland_seat_finalize (GObject *object) { @@ -4189,6 +4206,7 @@ gdk_wayland_seat_class_init (GdkWaylandSeatClass *klass) GdkSeatClass *seat_class = GDK_SEAT_CLASS (klass); object_class->finalize = gdk_wayland_seat_finalize; + object_class->dispose = gdk_wayland_seat_dispose; seat_class->get_capabilities = gdk_wayland_seat_get_capabilities; seat_class->grab = gdk_wayland_seat_grab;