[Bug 20299] New: hard to keep track of QSharedPointer's with AccountManager

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Feb 24 22:21:51 CET 2009


http://bugs.freedesktop.org/show_bug.cgi?id=20299

           Summary: hard to keep track of QSharedPointer's with
                    AccountManager
           Product: Telepathy
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: telepathy-qt4
        AssignedTo: telepathy-bugs at lists.freedesktop.org
        ReportedBy: ian.monroe at collabora.co.uk


For instance in the following code, where m_manager is a
Telepathy::Client::AccountManager:

    m_accounts = m_manager->allAccounts();
    foreach( int i = 0; i < m_accounts.size(); i++ )
    {
        connect( m_account.at( i )->becomeReady(),
            SIGNAL(finished(Telepathy::Client::PendingOperation *)),
            SLOT(accountReady(Telepathy::Client::PendingOperation *)));
    }

Standard stuff. allAccounts returns QSharedPointer's which are stored in a
QList (m_accounts). In the accountReady slot there is however no way to access
the QSharedPointer, so if accountReady wants to share the account with another
class it can't (at least not without additional hacks). 

The reason PendingAccountReady return a QSharedPointer is because some accounts
are created independently of AccountManager, so the strong pointer wouldn't be
available to PendingAccountReady. 

Something like KSharedPtr could solve it, since KSharedPtr keeps the refcounter
in the object instead of the pointer. QExplictlySharedDataPointer might work as
well.


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the telepathy-bugs mailing list