[Interest] QDBusConnection behavior after DBus Daemon has been re-started

Miller, Doug dmiller at JFTI.com
Wed Jun 5 22:55:40 CEST 2013


--sorry for the earlier mess

Take a simple application that establishes a connection via QDBusConnection::sessionBus().  If the DBus Daemon is shut down and restarted such that the environment variable DBUS_SESSION_BUS_ADDRESS is still set properly, then QDBusConnection::sessionBus() fails to return a connection.  The application itself will have to be restarted for any new connections to occur.

If one uses connectToBus(const QString & address, const QString & name) a similar problem exists even if disconnectFromBus(const QString & name) is first called with the same name and after the daemon has been restarted.  It is like there is a reference that can't be cleared.  If connectToBus(const QString & address, const QString & name) is called with a totally unique name then a connection will be established.  In fact my work-around was to have a name that had a component to it that could be incremented.

The loss of the DBusDaemon can easily occur when the daemon is running on another machine and connections are via a network.  Most uses of DBus have the daemon running locally so I guess this is why the problem has never been detected before.

Is there a work-around other than re-starting the application or generating unique names?

Thanks for any help.



More information about the Interest mailing list