The connection should be closed before executing
q_dbus_connection_unref(). Failing to do so results in an assertion
inside libdbus:
dbus[1573958]: The last reference on a connection was dropped
without closing the connection. This is a bug in an application.
See dbus_connection_unref() documentation for details.
Most likely, the application was supposed to call
dbus_connection_close(), since this is a private connection.
The q_dbus_bus_register() may fail if maximum number of active
connections for a bus was reached. This can be tested by creating
a custom bus with "max_completed_connections" parameter set to 0.
Add such a test to tst_qdbusconnection.
Fixes: QTBUG-34613
Change-Id: I6ae7df19bf8b6546c2a504931ba852dc15d35f78
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>