It looks to me as though dbus-glib isn't taking part in dbus' reference counting:
In dbus, as things are being torn down:
_dbus_watch_unref(... . . . if (watch->refcount == 0) { dbus_watch_set_data (watch, NULL, NULL); /* call free_data_function */
which frees the data.
in dbus-glib
connection_setup_add_watch(... . . . channel = g_io_channel_unix_new (dbus_watch_get_unix_fd (watch));
handler->source = g_io_create_watch (channel, condition); g_source_set_callback (handler->source, (GSourceFunc) io_handler_dispatch, handler, io_handler_source_finalized);
so io_handler_source_finalized will be called as the watch is torn down
io_handler_source_finalized (gpointer data) { IOHandler *handler;
handler = data;
if (handler->watch) dbus_watch_set_data (handler->watch, NULL, NULL);
which frees the data regardless.
I think this isn't an issue for every use, as we are in an exception case in dbus itself:
if (_dbus_message_loader_get_is_corrupted (transport->loader)) { _dbus_verbose ("Corrupted message stream, disconnecting\n"); _dbus_transport_disconnect (transport);
As for a fix, I'm not sure, should dbus-glib take part in the refcounting, or just not bother freeing the data and rely on dbus to do it?
Thanks,
James
It looks to me as though dbus-glib isn't taking part in dbus' reference counting:
In dbus, as things are being torn down:
_dbus_ watch_unref( ...
dbus_watch_ set_data (watch, NULL, NULL); /* call free_data_function */
.
.
.
if (watch->refcount == 0)
{
which frees the data.
in dbus-glib
connection_ setup_add_ watch(. .. unix_new (dbus_watch_ get_unix_ fd (watch));
.
.
.
channel = g_io_channel_
handler->source = g_io_create_watch (channel, condition); set_callback (handler->source, (GSourceFunc) io_handler_ dispatch, handler,
io_ handler_ source_ finalized) ;
g_source_
so io_handler_ source_ finalized will be called as the watch is torn down
io_handler_ source_ finalized (gpointer data)
{
IOHandler *handler;
handler = data;
if (handler->watch) watch_set_ data (handler->watch, NULL, NULL);
dbus_
which frees the data regardless.
I think this isn't an issue for every use, as we are in an exception case in
dbus itself:
if (_dbus_ message_ loader_ get_is_ corrupted (transport- >loader) ) dbus_transport_ disconnect (transport);
{
_dbus_verbose ("Corrupted message stream, disconnecting\n");
_
As for a fix, I'm not sure, should dbus-glib take part in the refcounting,
or just not bother freeing the data and rely on dbus to do it?
Thanks,
James