Creating a dbus connection

Havoc Pennington hp at
Thu Jul 5 09:41:21 PDT 2007


P. Durante wrote:
>> And in my program I am doing like:
>> DBus::Connection *pconn = DBus::Connection(bus_path);
>> pconn->register_connection();
>> After this it is working ok.
>> So I have a question, is there any other way already exist to register the
>> connection, or such function is missing and we need to add one as I did
>> above?
> Yes, it's a bug, as per the doc:
> "If you open a bus connection with dbus_connection_open() or
> dbus_connection_open_private() you will have to dbus_bus_register()
> yourself, or make the appropriate registration method calls yourself."
> the constructor should call it and it doesn't, this hasn't come up
> earlier because only the 'default' buses were being used.

I don't understand this - the docs you quoted indicate that 
connection_open() will not register with the bus, which is correct, 
because a DBusConnection does not have to be a connection to a bus.
So having the C++ wrapper for connection_open register isn't right either.

dbus_bus_get() does register with the bus, since it knows it's a bus.
In C++ I'd expect that to be wrapped separately and as a static or 
factory method, rather than as a constructor.


More information about the dbus mailing list