[Telepathy-commits] [telepathy-qt4/master] Account: Fixed account to return the proper manager if the manager was not used as parent object.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Wed Feb 11 12:55:33 PST 2009


---
 TelepathyQt4/Client/account.cpp |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/TelepathyQt4/Client/account.cpp b/TelepathyQt4/Client/account.cpp
index a62e757..e8612d4 100644
--- a/TelepathyQt4/Client/account.cpp
+++ b/TelepathyQt4/Client/account.cpp
@@ -57,9 +57,10 @@ namespace Client
 
 struct Account::Private
 {
-    Private(Account *parent);
+    Private(AccountManager *am, Account *parent);
     ~Private();
 
+    AccountManager *am;
     AccountInterface *baseInterface;
     bool ready;
     QList<PendingReadyAccount *> pendingOperations;
@@ -90,8 +91,9 @@ struct Account::Private
     QSharedPointer<Connection> connection;
 };
 
-Account::Private::Private(Account *parent)
-    : baseInterface(new AccountInterface(parent->dbusConnection(),
+Account::Private::Private(AccountManager *am, Account *parent)
+    : am(am),
+      baseInterface(new AccountInterface(parent->dbusConnection(),
                         parent->busName(), parent->objectPath(), parent)),
       ready(false),
       features(0),
@@ -152,7 +154,7 @@ Account::Account(AccountManager *am, const QString &objectPath,
     : StatelessDBusProxy(am->dbusConnection(),
             am->busName(), objectPath, parent),
       OptionalInterfaceFactory<Account>(this),
-      mPriv(new Private(this))
+      mPriv(new Private(am, this))
 {
     connect(mPriv->baseInterface,
             SIGNAL(Removed()),
@@ -180,7 +182,7 @@ Account::~Account()
  */
 AccountManager *Account::manager() const
 {
-    return qobject_cast<AccountManager *>(parent());
+    return mPriv->am;
 }
 
 /**
-- 
1.5.6.5




More information about the telepathy-commits mailing list