Commit fabef9f3 authored by Olivier Andrieu's avatar Olivier Andrieu
Browse files

* 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.
parent 0f2cd8ba
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
......
......@@ -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
......
......@@ -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 */
......@@ -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 */
......@@ -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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment