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 <thiago.macieira@intel.com>
This commit is contained in:
Ievgenii Meshcheriakov 2023-09-11 13:06:06 +02:00
parent eacff46af4
commit 178a5d15ef

View File

@ -306,7 +306,10 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
manager->addConnection( manager->addConnection(
"QDBusServer-"_L1 + QString::number(reinterpret_cast<qulonglong>(newConnection), 16), "QDBusServer-"_L1 + QString::number(reinterpret_cast<qulonglong>(newConnection), 16),
newConnection); newConnection);
serverConnection->serverConnectionNames << newConnection->name; {
QWriteLocker locker(&serverConnection->lock);
serverConnection->serverConnectionNames << newConnection->name;
}
// setPeer does the error handling for us // setPeer does the error handling for us
QDBusErrorInternal error; QDBusErrorInternal error;