diff options
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index cee5c821c8..1125480447 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1070,10 +1070,11 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() "Timer and socket errors will follow and the program will probably crash", qPrintable(name)); + auto lastMode = mode; // reset on connection close closeConnection(); qDeleteAll(cachedMetaObjects); - if (mode == ClientMode || mode == PeerMode) { + if (lastMode == ClientMode || lastMode == PeerMode) { // the bus service object holds a reference back to us; // we need to destroy it before we finish destroying ourselves Q_ASSERT(ref.load() == 0); @@ -1085,7 +1086,7 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() if (connection) q_dbus_connection_unref(connection); connection = 0; - } else if (mode == ServerMode) { + } else if (lastMode == ServerMode) { if (server) q_dbus_server_unref(server); server = 0; |