aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-07 15:14:54 -0600
committerTed Gould <ted@gould.cx>2011-03-07 15:14:54 -0600
commit480f30bcb3fb062d8cf48fa2a7089b1c55d4f080 (patch)
tree0208eeb417e091f4ba957f41c17af7af6b88b0df
parent5f36ab3e6268f99221d4f558bf1a1f16f8c11467 (diff)
parentdda3218105c73cecbbad57296eef3cd72168352b (diff)
downloadlibdbusmenu-480f30bcb3fb062d8cf48fa2a7089b1c55d4f080.tar.gz
libdbusmenu-480f30bcb3fb062d8cf48fa2a7089b1c55d4f080.tar.bz2
libdbusmenu-480f30bcb3fb062d8cf48fa2a7089b1c55d4f080.zip
Sync with U. Desktop
-rw-r--r--debian/changelog14
-rw-r--r--libdbusmenu-glib/menuitem.c20
2 files changed, 28 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog
index 463c5f5..bbd2b78 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+libdbusmenu (0.3.100-0ubuntu3) natty; urgency=low
+
+ * libdbusmenu-glib/menuitem.c
+ - Steal earlier instead of later so that signal handlers don't find the
+ value in the hashtable (LP: #725603) (LP: #730198)
+
+ -- Ken VanDine <ken.vandine@canonical.com> Mon, 07 Mar 2011 14:27:09 -0500
+
+libdbusmenu (0.3.100-0ubuntu2) natty; urgency=low
+
+ * Cherry picked fix for path to find types.h
+
+ -- Ken VanDine <ken.vandine@canonical.com> Fri, 04 Mar 2011 10:22:36 -0500
+
libdbusmenu (0.3.100-0ubuntu2~ppa1) natty; urgency=low
* Upstream Merge
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index f7867e4..2e5a345 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1180,17 +1180,23 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
}
}
-
gboolean replaced = FALSE;
gboolean remove = FALSE;
- gpointer currentval = g_hash_table_lookup(priv->properties, property);
+ gchar * hash_key = NULL;
+ GVariant * hash_variant = NULL;
+ gboolean inhash = g_hash_table_lookup_extended(priv->properties, property, (gpointer *)&hash_key, (gpointer *)&hash_variant);
+
+ if (inhash && hash_variant == NULL) {
+ g_warning("The property '%s' is in the hash with a NULL variant", property);
+ inhash = FALSE;
+ }
if (value != NULL) {
/* NOTE: We're only marking this as replaced if this is true
but we're actually replacing it no matter. This is so that
the variant passed in sticks around which the caller may
expect. They shouldn't, but it's low cost to remove bugs. */
- if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) {
+ if (!inhash || !g_variant_equal(hash_variant, value)) {
replaced = TRUE;
}
@@ -1204,7 +1210,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
bad value */
g_hash_table_insert(priv->properties, lprop, value);
} else {
- if (currentval != NULL) {
+ if (inhash) {
/* So the question you should be asking if you're paying attention
is "Why not just do the remove here?" It's a good question with
an interesting answer. Bascially it's the same reason as above,
@@ -1213,6 +1219,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
it) after the signal emition */
remove = TRUE;
replaced = TRUE;
+ g_hash_table_steal(priv->properties, property);
}
}
@@ -1220,7 +1227,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
becuse it has been unref'd when replaced in the hash
table. But the fact that there was a value is
the imporant part. */
- if (currentval == NULL || replaced) {
+ if (!inhash || replaced) {
GVariant * signalval = value;
if (signalval == NULL) {
@@ -1233,7 +1240,8 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
}
if (remove) {
- g_hash_table_remove(priv->properties, property);
+ g_free(hash_key);
+ g_variant_unref(hash_variant);
}
return TRUE;