[mutter] MetaWindowActor: keep a reference to the MetaWindow



commit 349fb7c29720ac99145213ea02fa8e5f1fdc8d6e
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Mar 7 22:22:19 2011 -0500

    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 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index ddffae3..83fcb49 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]