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 | |
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.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | bus/dispatch.c | 25 | ||||
-rw-r--r-- | bus/utils.h | 4 | ||||
-rw-r--r-- | dbus/dbus-errors.c | 2 | ||||
-rw-r--r-- | dbus/dbus-internals.h | 2 |
5 files changed, 28 insertions, 14 deletions
@@ -1,3 +1,12 @@ +2004-07-31 Olivier Andrieu <oliv__a@users.sourceforge.net> + + * 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. + 2004-07-31 Colin Walters <walters@redhat.com> * bus/selinux.c <HAVE_SELINUX>: Include utils.h to get 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 */ diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c index db7b5a86..ea38df9a 100644 --- a/dbus/dbus-errors.c +++ b/dbus/dbus-errors.c @@ -368,7 +368,7 @@ dbus_set_error (DBusError *error, return; nomem: - dbus_set_error_const (error, DBUS_ERROR_NO_MEMORY, NULL); + _DBUS_SET_OOM (error); } /** @} */ /* End public API */ diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 264d5f7c..0138fb30 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -215,7 +215,7 @@ const char* _dbus_type_to_string (int type); const char* _dbus_header_field_to_string (int header_field); extern const char _dbus_no_memory_message[]; -#define _DBUS_SET_OOM(error) dbus_set_error ((error), DBUS_ERROR_NO_MEMORY, _dbus_no_memory_message) +#define _DBUS_SET_OOM(error) dbus_set_error_const ((error), DBUS_ERROR_NO_MEMORY, _dbus_no_memory_message) #ifdef DBUS_BUILD_TESTS /* Memory debugging */ |