[Interest] QDBusConnection behavior after DBus Daemon has been restarted

Miller, Doug dmiller at JFTI.com
Wed Jun 5 22:47:23 CEST 2013


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<http://qt-project.org/doc/qt-5.0/qtdbus/qdbusconnection.html#connectToBus-2>(const QString & address, const QString & name) a similar problem exists even if disconnectFromBus<http://qt-project.org/doc/qt-5.0/qtdbus/qdbusconnection.html#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<http://qt-project.org/doc/qt-5.0/qtdbus/qdbusconnection.html#connectToBus-2>(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 connectios 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