From 35316a034faa9013315d29101a823d33093f6162 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Thu, 30 Jan 2020 09:52:08 +0100 Subject: [PATCH] selection: Unref selection owners on dispose Selection owners are set using g_set_object, which adds a reference to the owner, which then never was removed on shutdown. Fixes parts of https://gitlab.gnome.org/GNOME/mutter/issues/1006 https://gitlab.gnome.org/GNOME/mutter/merge_requests/1001 --- src/core/meta-selection.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core/meta-selection.c b/src/core/meta-selection.c index 504d322e7..e0ff9f4b1 100644 --- a/src/core/meta-selection.c +++ b/src/core/meta-selection.c @@ -50,9 +50,27 @@ static guint signals[N_SIGNALS] = { 0 }; G_DEFINE_TYPE (MetaSelection, meta_selection, G_TYPE_OBJECT) +static void +meta_selection_dispose (GObject *object) +{ + MetaSelection *selection = META_SELECTION (object); + guint i; + + for (i = 0; i < META_N_SELECTION_TYPES; i++) + { + g_clear_object (&selection->owners[i]); + } + + G_OBJECT_CLASS (meta_selection_parent_class)->dispose (object); +} + static void meta_selection_class_init (MetaSelectionClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = meta_selection_dispose; + signals[OWNER_CHANGED] = g_signal_new ("owner-changed", G_TYPE_FROM_CLASS (klass),