diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-11-27 15:02:57 +0100 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-12-07 23:36:15 +0100 |
commit | d3860918ea5237e63a49c059896cebf237d012b0 (patch) | |
tree | bc090ed1b80e4faffba91f133e330952bfe48821 /tests/auto/dbus/qdbusconnection/tst_qdbusconnection.conf | |
parent | c39fff0da59ac23a4b185aada4ee653f69a705d5 (diff) |
QDBusConnectionPrivate: Close connection after failed q_dbus_bus_register()
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>
Diffstat (limited to 'tests/auto/dbus/qdbusconnection/tst_qdbusconnection.conf')
-rw-r--r-- | tests/auto/dbus/qdbusconnection/tst_qdbusconnection.conf | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.conf b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.conf new file mode 100644 index 0000000000..7dec73d0d7 --- /dev/null +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.conf @@ -0,0 +1,23 @@ +<!-- This configuration file for tst_qdbusconnection. +--> + +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <type>tst_qdbusconnection</type> + + <listen>unix:tmpdir=/tmp</listen> + + <auth>EXTERNAL</auth> + + <policy context="default"> + <!-- Allow everything to be sent --> + <allow send_destination="*" eavesdrop="true"/> + <!-- Allow everything to be received --> + <allow eavesdrop="true"/> + <!-- Allow anyone to own anything --> + <allow own="*"/> + </policy> + + <limit name="max_completed_connections">0</limit> +</busconfig> |