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
This commit is contained in:
Owen W. Taylor 2011-03-07 22:22:19 -05:00
parent f9b5cdfeb1
commit 349fb7c297

View File

@ -497,6 +497,12 @@ meta_window_actor_dispose (GObject *object)
info->windows = g_list_remove (info->windows, (gconstpointer) self); 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. * Release the extra reference we took on the actor.
*/ */
@ -529,7 +535,11 @@ meta_window_actor_set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_META_WINDOW: 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; break;
case PROP_META_SCREEN: case PROP_META_SCREEN:
priv->screen = g_value_get_pointer (value); priv->screen = g_value_get_pointer (value);