mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 02:58:01 +02:00
2003-03-16 Havoc Pennington <hp@pobox.com>
* dbus/dbus-bus.c (ensure_bus_data): handle failure to set connection data * dbus/dbus-memory.c (_dbus_initialize_malloc_debug): support DBUS_MALLOC_BACKTRACES to print trace when failing an alloc
This commit is contained in:
parent
ebb57e719c
commit
d1f65c6c4f
5 changed files with 45 additions and 4 deletions
|
|
@ -1,3 +1,11 @@
|
|||
2003-03-16 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* dbus/dbus-bus.c (ensure_bus_data): handle failure to set
|
||||
connection data
|
||||
|
||||
* dbus/dbus-memory.c (_dbus_initialize_malloc_debug): support
|
||||
DBUS_MALLOC_BACKTRACES to print trace when failing an alloc
|
||||
|
||||
2003-03-16 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* dbus/dbus-string.c (_dbus_string_validate_utf8): oops, unbreak
|
||||
|
|
|
|||
|
|
@ -58,8 +58,11 @@ bus_connection_disconnected (DBusConnection *connection)
|
|||
BusService *service;
|
||||
|
||||
d = BUS_CONNECTION_DATA (connection);
|
||||
_dbus_assert (d != NULL);
|
||||
_dbus_assert (d != NULL);
|
||||
|
||||
_dbus_verbose ("%s disconnected, dropping all service ownership and releasing\n",
|
||||
d->name ? d->name : "(inactive)");
|
||||
|
||||
/* Drop any service ownership. FIXME Unfortunately, this requires
|
||||
* memory allocation and there doesn't seem to be a good way to
|
||||
* handle it other than sleeping; we can't "fail" the operation of
|
||||
|
|
@ -551,6 +554,8 @@ bus_connection_set_name (DBusConnection *connection,
|
|||
if (d->name == NULL)
|
||||
return FALSE;
|
||||
|
||||
_dbus_verbose ("Name %s assigned to %p\n", d->name, connection);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -654,11 +659,15 @@ bus_transaction_send_message (BusTransaction *transaction,
|
|||
to_send->message = message;
|
||||
to_send->transaction = transaction;
|
||||
|
||||
_dbus_verbose ("about to prepend message\n");
|
||||
|
||||
if (!_dbus_list_prepend (&d->transaction_messages, to_send))
|
||||
{
|
||||
message_to_send_free (connection, to_send);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_dbus_verbose ("prepended message\n");
|
||||
|
||||
/* See if we already had this connection in the list
|
||||
* for this transaction. If we have a pending message,
|
||||
|
|
|
|||
|
|
@ -412,7 +412,16 @@ static dbus_bool_t check_no_leftovers (BusContext *context);
|
|||
|
||||
static void
|
||||
flush_bus (BusContext *context)
|
||||
{
|
||||
{
|
||||
/* This is race condition city, obviously. since we're all in one
|
||||
* process we can't block, we just have to wait for data we put in
|
||||
* one end of the debug pipe to come out the other end...
|
||||
* a more robust setup would be good.
|
||||
*/
|
||||
|
||||
while (bus_loop_iterate (FALSE))
|
||||
;
|
||||
_dbus_sleep_milliseconds (15);
|
||||
while (bus_loop_iterate (FALSE))
|
||||
;
|
||||
}
|
||||
|
|
@ -863,6 +872,7 @@ check_hello_connection (BusContext *context)
|
|||
_dbus_assert_not_reached ("message other than disconnect dispatched after failure to register");
|
||||
dbus_connection_unref (connection);
|
||||
_dbus_assert (!bus_test_client_listed (connection));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -146,8 +146,13 @@ ensure_bus_data (DBusConnection *connection)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dbus_connection_set_data (connection, bus_data_slot, bd,
|
||||
bus_data_free);
|
||||
if (!dbus_connection_set_data (connection, bus_data_slot, bd,
|
||||
bus_data_free))
|
||||
{
|
||||
bus_data_free (bd);
|
||||
data_slot_unref ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Data slot refcount now held by the BusData */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ static size_t fail_size = 0;
|
|||
static int fail_alloc_counter = _DBUS_INT_MAX;
|
||||
static dbus_bool_t guards = FALSE;
|
||||
static dbus_bool_t disable_mem_pools = FALSE;
|
||||
static dbus_bool_t backtrace_on_fail_alloc = FALSE;
|
||||
|
||||
/** value stored in guard padding for debugging buffer overrun */
|
||||
#define GUARD_VALUE 0xdeadbeef
|
||||
|
|
@ -126,6 +127,12 @@ _dbus_initialize_malloc_debug (void)
|
|||
disable_mem_pools = TRUE;
|
||||
_dbus_verbose ("Will disable memory pools\n");
|
||||
}
|
||||
|
||||
if (_dbus_getenv ("DBUS_MALLOC_BACKTRACES") != NULL)
|
||||
{
|
||||
backtrace_on_fail_alloc = TRUE;
|
||||
_dbus_verbose ("Will backtrace on failing a malloc\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,6 +203,8 @@ _dbus_decrement_fail_alloc_counter (void)
|
|||
fail_alloc_counter = _DBUS_INT_MAX;
|
||||
|
||||
_dbus_verbose ("reset fail alloc counter to %d\n", fail_alloc_counter);
|
||||
if (backtrace_on_fail_alloc)
|
||||
_dbus_print_backtrace ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue