diff options
author | Ted Gould <ted@gould.cx> | 2010-07-20 09:55:08 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-07-20 09:55:08 -0500 |
commit | 7941bec0ab70845d60efd374b5dae4976197e4b5 (patch) | |
tree | 8143784d2967bdc43f07cd43fd1b43056defe843 /libdbusmenu-glib | |
parent | 08fae7619012309a0ef9024c1e91effc7bf99529 (diff) | |
download | libdbusmenu-7941bec0ab70845d60efd374b5dae4976197e4b5.tar.gz libdbusmenu-7941bec0ab70845d60efd374b5dae4976197e4b5.tar.bz2 libdbusmenu-7941bec0ab70845d60efd374b5dae4976197e4b5.zip |
Cleaning up our arrays, with some callbacks, eh, it's what we gotta do.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 4faf7c6..5e8c08a 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -241,8 +241,38 @@ dbusmenu_client_dispose (GObject *object) priv->delayed_idle = 0; } - /* TODO: Handle delayed_property_list */ - /* TODO: Handle delayed_property_listeners */ + /* Only used for queueing up a new command, so we can + just drop this array. */ + if (priv->delayed_property_list == NULL) { + gchar ** dataregion = (gchar **)g_array_free(priv->delayed_property_list, FALSE); + if (dataregion != NULL) { + g_strfreev(dataregion); + } + priv->delayed_property_list = NULL; + } + + if (priv->delayed_property_listeners == NULL) { + gint i; + GError * localerror = NULL; + + /* Making sure all the callbacks get called so that if they had + memory in their user_data that needs to be free'd that happens. */ + for (i = 0; i < priv->delayed_property_listeners->len; i++) { + properties_listener_t * listener = &g_array_index(priv->delayed_property_listeners, properties_listener_t, i); + if (!listener->replied) { + if (localerror == NULL) { + g_set_error_literal(&localerror, 0, 0, "DbusmenuClient Shutdown"); + } + listener->callback(priv->menuproxy, NULL, localerror, listener->user_data); + } + } + if (localerror != NULL) { + g_error_free(localerror); + } + + g_array_free(priv->delayed_property_listeners, TRUE); + priv->delayed_property_listeners = NULL; + } if (priv->layoutcall != NULL) { dbus_g_proxy_cancel_call(priv->menuproxy, priv->layoutcall); |