diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-04-05 10:21:41 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-04-05 10:21:41 -0500 |
commit | 1675e00fa719944312998ab702d2aa7b5eb7b30c (patch) | |
tree | 98f07c4cb84e54623ececa8d112404f65c499568 /libdbusmenu-glib | |
parent | 2d60549a2394ce7d73907abcaca22b48553d6c5b (diff) | |
parent | 9e5453bb93db68695d5fd4c1e8de8003a400f7d6 (diff) | |
download | libdbusmenu-1675e00fa719944312998ab702d2aa7b5eb7b30c.tar.gz libdbusmenu-1675e00fa719944312998ab702d2aa7b5eb7b30c.tar.bz2 libdbusmenu-1675e00fa719944312998ab702d2aa7b5eb7b30c.zip |
merge lp:~ted/dbusmenu/about-to-show-null-cb-protect to fix the about-to-show callback to better handle having a NULL callback, and thus NULL data. Putting some protections in as well so we'll get better errors from it if we make this mistake again.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 34f8b8d..ed89d86 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1834,6 +1834,8 @@ struct _about_to_show_t { static void about_to_show_finish (about_to_show_t * data, gboolean need_update) { + g_return_if_fail(data != NULL); + /* If we need to update, do that first. */ if (need_update) { update_layout(data->client); @@ -1938,6 +1940,8 @@ about_to_show_idle (gpointer user_data) GQueue * showers = priv->about_to_show_to_go; priv->about_to_show_to_go = NULL; + g_return_val_if_fail(showers != NULL, FALSE); + /* Figure out if we've got any callbacks */ gboolean got_callbacks = FALSE; g_queue_foreach(showers, about_to_show_idle_callbacks, &got_callbacks); @@ -1995,7 +1999,10 @@ about_to_show_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) g_variant_unref(params); } - about_to_show_finish(data, need_update); + if (data != NULL) { + about_to_show_finish(data, need_update); + } + return; } @@ -2028,11 +2035,15 @@ dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb)( priv->about_to_show_idle = g_idle_add(about_to_show_idle, client); } } else { + GAsyncReadyCallback dbuscb = NULL; + /* If there's no callback we don't need this data, let's clean it up in a consistent way */ if (cb == NULL) { about_to_show_finish(data, FALSE); data = NULL; + } else { + dbuscb = about_to_show_cb; } g_dbus_proxy_call(priv->menuproxy, @@ -2041,7 +2052,7 @@ dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb)( G_DBUS_CALL_FLAGS_NONE, -1, /* timeout */ NULL, /* cancellable */ - about_to_show_cb, + dbuscb, data); } |