summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusintegrator.cpp
diff options
context:
space:
mode:
authorIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2023-05-02 15:25:51 +0200
committerIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2023-05-11 19:58:12 +0200
commit859ef056331a94fb0b1e4b41f596ff78539dfd8b (patch)
tree6f40a20978ae6fbc00ed61e80fc940b0cf947b17 /src/dbus/qdbusintegrator.cpp
parentb0f78c22bde854ee34f8e2b6d219e82759f55e53 (diff)
QDBusConnectionPrivate: Fix handling of queued messages
Handle any queued messages before attempting to dispatch any newly received messages. This ensures that messages are processed in the order they were sent. Add a regression test for this bug using code adapted from the bug report by Pascal Weisser. Because of the nature of the bug, this new test does not always fail even when compiled with affected versions of Qt though. Fixes: QTBUG-105457 Pick-to: 6.2 6.5 Change-Id: I2725f3450ad537d63d6660e21645ac2c578e1768 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r--src/dbus/qdbusintegrator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 519b8d1fa4..5f95465b30 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1173,7 +1173,6 @@ void QDBusConnectionPrivate::timerEvent(QTimerEvent *e)
void QDBusConnectionPrivate::doDispatch()
{
if (mode == ClientMode || mode == PeerMode) {
- while (q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS) ;
if (dispatchEnabled && !pendingMessages.isEmpty()) {
// dispatch previously queued messages
PendingMessageList::Iterator it = pendingMessages.begin();
@@ -1184,6 +1183,7 @@ void QDBusConnectionPrivate::doDispatch()
}
pendingMessages.clear();
}
+ while (q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS) ;
}
}