From 349fb7c29720ac99145213ea02fa8e5f1fdc8d6e Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Mon, 7 Mar 2011 22:22:19 -0500 Subject: [PATCH] MetaWindowActor: keep a reference to the MetaWindow Until the actor is destroyed, we need to have access to the MetaWindow to access some fields used for painting. Keep a strong reference to the window rather than just hoping the window will not be freed. https://bugzilla.gnome.org/show_bug.cgi?id=642787 --- src/compositor/meta-window-actor.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index ddffae3ea..83fcb49b6 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -497,6 +497,12 @@ meta_window_actor_dispose (GObject *object) info->windows = g_list_remove (info->windows, (gconstpointer) self); + if (priv->window) + { + g_object_unref (priv->window); + priv->window = NULL; + } + /* * Release the extra reference we took on the actor. */ @@ -529,7 +535,11 @@ meta_window_actor_set_property (GObject *object, switch (prop_id) { case PROP_META_WINDOW: - priv->window = g_value_get_object (value); + { + if (priv->window) + g_object_unref (priv->window); + priv->window = g_value_dup_object (value); + } break; case PROP_META_SCREEN: priv->screen = g_value_get_pointer (value);