[maemo-commits] [maemo-commits] r17994 - in projects/haf/trunk/libmatchbox2: . matchbox/comp-mgr matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Apr 2 14:10:52 EEST 2009
Author: gw
Date: 2009-04-02 14:10:50 +0300 (Thu, 02 Apr 2009)
New Revision: 17994

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c
Log:
2009-04-02  Gordon Williams  <gordon.williams at collabora.co.uk>

	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c: More fixes for
	  g_object_unref - deal with weak reference on clutter
	  actors.


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-04-02 11:08:24 UTC (rev 17993)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-04-02 11:10:50 UTC (rev 17994)
@@ -1,3 +1,9 @@
+2009-04-02  Gordon Williams  <gordon.williams at collabora.co.uk>
+
+	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c: More fixes for
+	  g_object_unref - deal with weak reference on clutter
+	  actors.
+
 2009-04-02  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	Release 0.2.28

Modified: projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-04-02 11:08:24 UTC (rev 17993)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-04-02 11:10:50 UTC (rev 17994)
@@ -18,6 +18,8 @@
  *
  */
 
+//#define DEBUG_ACTOR 1
+
 #ifndef HAVE_CLUTTER_EGLX
 /* Gordon says: */
 #define HAVE_CLUTTER_EGLX 0
@@ -273,7 +275,7 @@
   cclient->priv =
     mb_wm_util_malloc0 (sizeof (MBWMCompMgrClutterClientPrivate));
 
-  cclient->priv->actor = g_object_ref( clutter_group_new() );
+  cclient->priv->actor = g_object_ref_sink( clutter_group_new() );
   cclient->priv->bound = FALSE;
 
   g_object_set_data (G_OBJECT (cclient->priv->actor),
@@ -326,12 +328,7 @@
             }
         }
 
-      /* We can't just call clutter_group_new or it gets freed if it gets
-       * reparented, so we have to ref it - which means we need TWO
-       * unrefs here */
       g_object_unref (cclient->priv->actor);
-      g_object_unref (cclient->priv->actor);
-
       cclient->priv->actor = NULL;
     }
   if (cclient->priv->texture)
@@ -1063,7 +1060,7 @@
     clutter_actor_destroy(cclient->priv->texture);
   /* We need to reference this object so it does not get accidentally freed in
    * the case of AnimationActors */
-  cclient->priv->texture = g_object_ref(texture);
+  cclient->priv->texture = g_object_ref_sink(texture);
 #if DEBUG_ACTOR
   g_signal_connect(cclient->priv->texture, "destroy", G_CALLBACK(destroy_cb), cclient);
 #endif

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c	2009-04-02 11:08:24 UTC (rev 17993)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c	2009-04-02 11:10:50 UTC (rev 17994)
@@ -170,15 +170,17 @@
 }
 
 static inline void
-call_handlers_for_event (MBWMList *iter,
+call_handlers_for_event (MBWMList *iter_base,
 			 void *event,
 			 Window xwin
 			 )
 {
+  MBWMList *iter = iter_base;
   while (iter)
     {
       MBWMXEventFuncInfo *i = iter->data;
       MBWMList        *next = iter->next;
+      MBWMList        *iter_check = iter_base;
 
       if (i && (i->xwindow == None || i->xwindow == xwin))
 	{
@@ -194,6 +196,10 @@
 	    }
 	}
 
+      while (iter_check && iter_check!=next)
+        iter_check = iter_check->next;
+      g_assert(iter_check == next);
+
       iter = next;
     }
 }


More information about the maemo-commits mailing list