summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-07-08 18:15:37 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-12 14:53:12 +0200
commit9f3f4551511b63a3f230a8d71718d0d5fa352a28 (patch)
tree84a53a7368547409ae21f0097093d195e342c767 /src
parent7e7c689c347ce1497d06ced5aca72d78ee75cf99 (diff)
Fix disconnectFrom{Peer,Bus} when the connection failed
If the connection failed, the DBusConnection object is null, but we still add our QDBusConnectionPrivate to the global hash (maybe we shouldn't). Both disconnectFromXXX functions check that they are disconnecting a connection of the right type, but we never initialized the type if the connection failed. So simply make sure we initialize before handling the error state. Task-number: QTBUG-27973 Change-Id: I96f4825ab1b71adf1b72caf4f72db41742b44a55 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/dbus/qdbusintegrator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index afb8506b28..d5c359aea1 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1681,13 +1681,13 @@ static dbus_int32_t server_slot = -1;
void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error)
{
+ mode = ServerMode;
if (!s) {
handleError(error);
return;
}
server = s;
- mode = ServerMode;
dbus_bool_t data_allocated = q_dbus_server_allocate_data_slot(&server_slot);
if (data_allocated && server_slot < 0)
@@ -1718,13 +1718,13 @@ void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &
void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal &error)
{
+ mode = PeerMode;
if (!c) {
handleError(error);
return;
}
connection = c;
- mode = PeerMode;
q_dbus_connection_set_exit_on_disconnect(connection, false);
q_dbus_connection_set_watch_functions(connection,
@@ -1771,13 +1771,13 @@ static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnecti
void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusErrorInternal &error)
{
+ mode = ClientMode;
if (!dbc) {
handleError(error);
return;
}
connection = dbc;
- mode = ClientMode;
const char *service = q_dbus_bus_get_unique_name(connection);
Q_ASSERT(service);