From 46dee933ac3c2b140a6d65056a5ed5876302cd25 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Tue, 10 Feb 2009 18:02:13 +0800 Subject: Fix crash problems. --- bus/inputcontext.c | 7 ++++--- src/ibusconnection.c | 30 ++++++++++++++++-------------- src/ibusmessage.c | 2 +- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/bus/inputcontext.c b/bus/inputcontext.c index c512e82..be45bbe 100644 --- a/bus/inputcontext.c +++ b/bus/inputcontext.c @@ -558,13 +558,14 @@ _ic_process_key_event_reply_cb (gpointer data, { gboolean retval; CallData *call_data; - IBusMessage *reply; - BusInputContextPrivate *priv; - priv = BUS_INPUT_CONTEXT_GET_PRIVATE (call_data->context); retval = (gboolean) GPOINTER_TO_INT (data); call_data = (CallData *) user_data; + + BusInputContextPrivate *priv; + priv = BUS_INPUT_CONTEXT_GET_PRIVATE (call_data->context); + reply = ibus_message_new_method_return (call_data->message); ibus_message_append_args (reply, diff --git a/src/ibusconnection.c b/src/ibusconnection.c index 4821d6d..acc9037 100644 --- a/src/ibusconnection.c +++ b/src/ibusconnection.c @@ -605,13 +605,16 @@ ibus_connection_send_with_reply_and_block (IBusConnection *connection, connection_signals[IBUS_MESSAGE_SENT], 0, message); + ibus_error_free (_error); } - - if (reply == NULL && error != NULL) { + else { + if (error != NULL) { *error = _error; + } + else { + ibus_error_free (_error); + } } - else - ibus_error_free (_error); return reply; } @@ -666,8 +669,9 @@ ibus_connection_call (IBusConnection *connection, if (error) { *error = tmp_error; } - else + else { ibus_error_free (tmp_error); + } ibus_message_unref (reply); return FALSE; } @@ -676,7 +680,7 @@ ibus_connection_call (IBusConnection *connection, type = first_arg_type; - while (type != DBUS_TYPE_INVALID) { + while (type != G_TYPE_INVALID) { va_arg (args, gpointer); type = va_arg (args, GType); } @@ -685,16 +689,14 @@ ibus_connection_call (IBusConnection *connection, if (type != G_TYPE_INVALID) { retval = ibus_message_get_args_valist (reply, error, type, args); } - - va_end (args); - - ibus_message_unref (reply); - - if (!retval) { - return FALSE; + else { + retval = TRUE; } + + va_end (args); + ibus_message_unref (reply); - return TRUE; + return retval; } void diff --git a/src/ibusmessage.c b/src/ibusmessage.c index 08457a3..0541778 100644 --- a/src/ibusmessage.c +++ b/src/ibusmessage.c @@ -424,7 +424,7 @@ ibus_message_get_args_valist (IBusMessage *message, if (!retval) { if (error) { *error = ibus_error_new_from_printf (DBUS_ERROR_INVALID_ARGS, - "Message does not have arguments!"); + "Message does not have arguments!"); } return FALSE; } -- cgit