From 178a5d15efdebd498dbc0633425a1790a93aac54 Mon Sep 17 00:00:00 2001 From: Ievgenii Meshcheriakov Date: Mon, 11 Sep 2023 13:06:06 +0200 Subject: [PATCH] QDBusConnectionPrivate: Protect access to serverConnectionNames with mutex This list is accessed by ~QDBusServerConnection in a user thead. Task-number: QTBUG-116621 Change-Id: Ic115612b2a0f12fd9f69f38f4662dc36fffbf178 Reviewed-by: Thiago Macieira --- src/dbus/qdbusintegrator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index e0478d0d48..a6105d4403 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -306,7 +306,10 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v manager->addConnection( "QDBusServer-"_L1 + QString::number(reinterpret_cast(newConnection), 16), newConnection); - serverConnection->serverConnectionNames << newConnection->name; + { + QWriteLocker locker(&serverConnection->lock); + serverConnection->serverConnectionNames << newConnection->name; + } // setPeer does the error handling for us QDBusErrorInternal error;