diff options
author | Ted Gould <ted@gould.cx> | 2011-03-24 11:34:06 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-24 11:34:06 -0500 |
commit | 8ca65880181f4468e2c991b5072a460dc4ba34d5 (patch) | |
tree | b6eec2745798446778dc5b2637f9945d38c1e5fb /libdbusmenu-glib | |
parent | f6331ac53d77382238226390f2ab209d1ad24d58 (diff) | |
parent | 4af5b0e9cd08de5681bb6711da7ba283b4d0c3dd (diff) | |
download | libdbusmenu-8ca65880181f4468e2c991b5072a460dc4ba34d5.tar.gz libdbusmenu-8ca65880181f4468e2c991b5072a460dc4ba34d5.tar.bz2 libdbusmenu-8ca65880181f4468e2c991b5072a460dc4ba34d5.zip |
* Upstream Merge
* Putting in protections on properties that we don't quite
understand.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 24d5c5d..049cc91 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1333,8 +1333,16 @@ menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data if (error != NULL) { g_warning("Error getting properties on a menuitem: %s", error->message); - g_object_unref(data); - return; + goto out; + } + + if (properties == NULL) { + goto out; + } + + if (!g_variant_is_of_type(properties, G_VARIANT_TYPE("a{sv}"))) { + g_warning("Properties are of type '%s' instead of type '%s'", g_variant_get_type_string(properties), "a{sv}"); + goto out; } GVariantIter iter; @@ -1347,6 +1355,7 @@ menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data dbusmenu_menuitem_property_set_variant(item, key, value); } +out: g_object_unref(data); return; @@ -1365,12 +1374,16 @@ menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpoin g_warning("Unable to replace properties on %d: %s", dbusmenu_menuitem_get_id(DBUSMENU_MENUITEM(data)), error->message); have_error = TRUE; } + + if (properties == NULL) { + have_error = TRUE; + } /* Get the list of the current properties */ GList * current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data)); GList * tmp = NULL; - if (properties != NULL) { + if (!have_error && g_variant_is_of_type(properties, G_VARIANT_TYPE("a{sv}"))) { GVariantIter iter; g_variant_iter_init(&iter, properties); gchar * name; GVariant * value; @@ -1414,8 +1427,12 @@ menuitem_get_properties_new_cb (GVariant * properties, GError * error, gpointer if (error != NULL) { g_warning("Error getting properties on a new menuitem: %s", error->message); - g_object_unref(propdata->item); - return; + goto out; + } + + if (properties == NULL) { + g_warning("Not realizing new item as properties for it were unavailable"); + goto out; } DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(propdata->client); @@ -1449,6 +1466,7 @@ menuitem_get_properties_new_cb (GVariant * properties, GError * error, gpointer g_signal_emit(G_OBJECT(propdata->client), signals[NEW_MENUITEM], 0, propdata->item, TRUE); } +out: g_object_unref(propdata->item); g_free(propdata); |