Mercurial > pidgin.yaz
changeset 17019:3130a2cfe4e0
Show some more useful information when some signal causes some dbus warning/error.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 10 May 2007 21:47:47 +0000 |
parents | 481e8da0d6a2 |
children | 0682981f6797 47a9ba4f4373 |
files | libpurple/dbus-server.c |
diffstat | 1 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/dbus-server.c Thu May 10 21:45:55 2007 +0000 +++ b/libpurple/dbus-server.c Thu May 10 21:47:47 2007 +0000 @@ -654,11 +654,12 @@ #define my_arg(type) (ptr != NULL ? * ((type *)ptr) : va_arg(data, type)) -static void +static gboolean purple_dbus_message_append_purple_values(DBusMessageIter *iter, int number, PurpleValue **purple_values, va_list data) { int i; + gboolean error = FALSE; for (i = 0; i < number; i++) { @@ -668,11 +669,12 @@ guint xuint; gboolean xboolean; gpointer ptr = NULL; + gpointer val; if (purple_value_is_outgoing(purple_values[i])) { ptr = my_arg(gpointer); - g_return_if_fail(ptr); + g_return_val_if_fail(ptr, TRUE); } switch (purple_values[i]->type) @@ -705,14 +707,18 @@ case PURPLE_TYPE_POINTER: case PURPLE_TYPE_OBJECT: case PURPLE_TYPE_BOXED: - id = purple_dbus_pointer_to_id(my_arg(gpointer)); + val = my_arg(gpointer); + id = purple_dbus_pointer_to_id(val); + if (id == 0 && val != NULL) + error = TRUE; /* Some error happened. */ dbus_message_iter_append_basic(iter, (sizeof(void *) == 4) ? DBUS_TYPE_UINT32 : DBUS_TYPE_UINT64, &id); break; default: /* no conversion implemented */ - g_return_if_reached(); + g_return_val_if_reached(TRUE); } } + return error; } #undef my_arg @@ -746,7 +752,8 @@ signal = dbus_message_new_signal(DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, newname); dbus_message_iter_init_append(signal, &iter); - purple_dbus_message_append_purple_values(&iter, num_values, values, vargs); + if (purple_dbus_message_append_purple_values(&iter, num_values, values, vargs)) + purple_debug_warning("dbus", "The signal \"%s\" caused some dbus error.\n", name); dbus_connection_send(purple_dbus_connection, signal, NULL);