dbus_bus_get ownership issue

Alexander Larsson alexl at redhat.com
Mon Jul 3 07:04:46 PDT 2006


How am I supposed to handle ownership of the connection I get from
dbus_bus_get() ? It returns a ref:ed connection, but I can't unref it,
because that will assert if I happen to be the first caller of
dbus_bus_get() for this process (my code is in a library):

1451: assertion failed "!_dbus_transport_get_is_connected
(connection->transport)" file "dbus-connection.c" line 1797 function
_dbus_connection_last_unref

I have no way of telling if I'm the first to call dbus_bus_get, so
currently I'm just leaking the DBusConnection to avoid asserting.
Furthermore, even if I was able to unref the connection i'm not really
sure it makes sense to unref the internal shared connection. I'm sure
someone else will use it soon again, which should reuse the same
connection.

We should probably get this fixed before 1.0.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's an all-American small-town shaman with a passion for fast cars. She's a 
mentally unstable kleptomaniac barmaid from out of town. They fight crime! 



More information about the dbus mailing list