diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2010-12-30 13:38:15 -0200 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2010-12-31 11:20:39 -0200 |
commit | 4968d0204fdcba2a9c3d9a7749623e9d1b26269f (patch) | |
tree | c499ee7f95df48b2f72400d288c1a17a7e49c5fb | |
parent | d01975b318fc56191b4e658abd7a968935530b89 (diff) |
Connection: No need to keep a ref for connection in PendingConnect, use proxy() instead.
-rw-r--r-- | TelepathyQt4/connection-internal.h | 2 | ||||
-rw-r--r-- | TelepathyQt4/connection.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/TelepathyQt4/connection-internal.h b/TelepathyQt4/connection-internal.h index 6e30ce83..617fe261 100644 --- a/TelepathyQt4/connection-internal.h +++ b/TelepathyQt4/connection-internal.h @@ -46,8 +46,6 @@ private Q_SLOTS: private: friend class ConnectionLowlevel; - - ConnectionPtr connection; }; class ConnectionHelper diff --git a/TelepathyQt4/connection.cpp b/TelepathyQt4/connection.cpp index f11b6dd3..88881eee 100644 --- a/TelepathyQt4/connection.cpp +++ b/TelepathyQt4/connection.cpp @@ -740,7 +740,7 @@ ConnectionPtr ConnectionLowlevel::connection() const Connection::PendingConnect::PendingConnect(const ConnectionPtr &connection, const Features &requestedFeatures) - : PendingReady(connection, requestedFeatures), connection(connection) + : PendingReady(connection, requestedFeatures) { if (!connection) { // Called when the connection had already been destroyed @@ -817,6 +817,8 @@ void Connection::PendingConnect::onStatusChanged(ConnectionStatus newStatus) void Connection::PendingConnect::onBecomeReadyReply(Tp::PendingOperation *op) { + ConnectionPtr connection = ConnectionPtr::qObjectCast(proxy()); + // We don't care about future disconnects even if they happen before we are destroyed // (which happens two mainloop iterations from now) connection->disconnect(this, @@ -843,6 +845,8 @@ void Connection::PendingConnect::onBecomeReadyReply(Tp::PendingOperation *op) void Connection::PendingConnect::onConnInvalidated(Tp::DBusProxy *proxy, const QString &error, const QString &message) { + ConnectionPtr connection = ConnectionPtr::qObjectCast(this->proxy()); + Q_ASSERT(proxy == connection.data()); if (!isFinished()) { |