← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 90: Update to clean up dbusmenu on syncing so we have references properly.

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/crash-and-repeat/+merge/22533
  proposed by: Ted Gould (ted)
  review: Approve - Cody Russell (bratsche)
------------------------------------------------------------
revno: 90 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-03-31 11:05:24 -0500
message:
  Update to clean up dbusmenu on syncing so we have references properly.
modified:
  libdbusmenu-glib/client.c


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c	2010-02-24 19:17:38 +0000
+++ libdbusmenu-glib/client.c	2010-03-31 13:59:36 +0000
@@ -337,7 +337,12 @@
 	g_return_if_fail(priv->root != NULL);
 
 	DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id);
-	g_return_if_fail(menuitem != NULL);
+	if (menuitem == NULL) {
+		#ifdef MASSIVEDEBUGGING
+		g_debug("Property update '%s' on id %d which couldn't be found", property, id);
+		#endif
+		return;
+	}
 
 	dbusmenu_menuitem_property_set_value(menuitem, property, value);
 
@@ -444,6 +449,9 @@
 		priv->layoutcall = NULL;
 	}
 
+	priv->current_revision = 0;
+	priv->my_revision = 0;
+
 	build_dbus_proxy(DBUSMENU_CLIENT(userdata));
 	return;
 }
@@ -794,13 +802,17 @@
 		   clean up that old root */
 		if (oldroot != NULL) {
 			dbusmenu_menuitem_set_root(oldroot, FALSE);
-			g_object_unref(oldroot);
 		}
 
 		/* If the root changed we can signal that */
 		g_signal_emit(G_OBJECT(client), signals[ROOT_CHANGED], 0, priv->root, TRUE);
 	}
 
+	/* We need to unref it in this function no matter */
+	if (oldroot != NULL) {
+		g_object_unref(oldroot);
+	}
+
 	return 1;
 }