diff options
author | Olivier Andrieu <oliv__a@users.sourceforge.net> | 2004-07-31 09:15:24 +0000 |
---|---|---|
committer | Olivier Andrieu <oliv__a@users.sourceforge.net> | 2004-07-31 09:15:24 +0000 |
commit | fabef9f3992a6a14bf649bbde73ce3d86542764e (patch) | |
tree | a4be08b4c75f2f8193101a84b4072307f81a556e /bus | |
parent | 0f2cd8ba8e600a55cab538b195f9e6461172ee75 (diff) |
* dbus/dbus-internals.h (_DBUS_SET_OOM):
* bus/utils.h (BUS_SET_OOM): use dbus_error_set_const instead of
dbus_error_set.
* bus/dispatch.c (check_send_exit_to_service): fix the test case,
broken by the change in the _SET_OOM macros.
Diffstat (limited to 'bus')
-rw-r--r-- | bus/dispatch.c | 25 | ||||
-rw-r--r-- | bus/utils.h | 4 |
2 files changed, 17 insertions, 12 deletions
diff --git a/bus/dispatch.c b/bus/dispatch.c index 9bc89a7c..51112ce7 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -432,6 +432,16 @@ pop_message_waiting_for_memory (DBusConnection *connection) return dbus_connection_pop_message (connection); } +static DBusMessage* +borrow_message_waiting_for_memory (DBusConnection *connection) +{ + while (dbus_connection_get_dispatch_status (connection) == + DBUS_DISPATCH_NEED_MEMORY) + _dbus_wait_for_memory (); + + return dbus_connection_borrow_message (connection); +} + static void warn_unexpected_real (DBusConnection *connection, DBusMessage *message, @@ -1902,16 +1912,11 @@ check_service_deactivated (BusContext *context, const char *activated_name, const char *base_service) { - DBusMessage *message; dbus_bool_t retval; - DBusError error; CheckServiceDeletedData csdd; - message = NULL; retval = FALSE; - dbus_error_init (&error); - /* Now we are expecting ServiceDeleted messages for the base * service and the activated_name. The base service * notification is required to come last. @@ -1935,9 +1940,6 @@ check_service_deactivated (BusContext *context, retval = TRUE; out: - if (message) - dbus_message_unref (message); - return retval; } @@ -1995,7 +1997,7 @@ check_send_exit_to_service (BusContext *context, /* see if we got an error during message bus dispatching */ bus_test_run_clients_loop (FALSE); - message = dbus_connection_borrow_message (connection); + message = borrow_message_waiting_for_memory (connection); got_error = message != NULL && dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR; if (message) { @@ -2883,7 +2885,10 @@ check2_try_iterations (BusContext *context, if (!_dbus_test_oom_handling (description, check_oom_check2_func, &d)) - _dbus_assert_not_reached ("test failed"); + { + _dbus_warn ("%s failed during oom\n", description); + _dbus_assert_not_reached ("test failed"); + } } dbus_bool_t diff --git a/bus/utils.h b/bus/utils.h index 5f065a1c..6a5d61ff 100644 --- a/bus/utils.h +++ b/bus/utils.h @@ -28,9 +28,9 @@ #include <dbus/dbus.h> extern const char bus_no_memory_message[]; -#define BUS_SET_OOM(error) dbus_set_error ((error), DBUS_ERROR_NO_MEMORY, bus_no_memory_message) +#define BUS_SET_OOM(error) dbus_set_error_const ((error), DBUS_ERROR_NO_MEMORY, bus_no_memory_message) void bus_connection_dispatch_all_messages (DBusConnection *connection); dbus_bool_t bus_connection_dispatch_one_message (DBusConnection *connection); -#endif /* BUS_ACTIVATION_H */ +#endif /* BUS_UTILS_H */ |