diff options
author | Ted Gould <ted@canonical.com> | 2009-08-27 09:00:56 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-27 09:00:56 -0500 |
commit | 0b3053b799eab488746383a2aadfe20c015a051c (patch) | |
tree | ea9d7cd0e44afb251a749a0ad58bab35ed90663c /libdbusmenu-glib | |
parent | c05db6674b1ca087fce872b318e086c2b0a08679 (diff) | |
parent | 9e5b9b3ce66ff01c8395ea28bc227bb34cb50f8e (diff) | |
download | libdbusmenu-0b3053b799eab488746383a2aadfe20c015a051c.tar.gz libdbusmenu-0b3053b799eab488746383a2aadfe20c015a051c.tar.bz2 libdbusmenu-0b3053b799eab488746383a2aadfe20c015a051c.zip |
Changes from Neil's code review.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ffde8e3..dd2254e 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -537,6 +537,8 @@ menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError static void menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data) { + g_return_if_fail(data != NULL); + newItemPropData * propdata = (newItemPropData *)data; DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(propdata->client); @@ -620,11 +622,15 @@ parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * it /* Get the properties queued up for this item */ /* Not happy about this, but I need these :( */ newItemPropData * propdata = g_new0(newItemPropData, 1); - propdata->client = client; - propdata->item = item; - propdata->parent = parent; - - org_freedesktop_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_new_cb, propdata); + if (propdata != NULL) { + propdata->client = client; + propdata->item = item; + propdata->parent = parent; + + org_freedesktop_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_new_cb, propdata); + } else { + g_warning("Unable to allocate memory to get properties for menuitem. This menuitem will never be realized."); + } } xmlNodePtr children; @@ -830,6 +836,7 @@ gboolean dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc) { g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), FALSE); + g_return_val_if_fail(type != NULL, FALSE); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); |