[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kopete walletmanager static destruction order
From:       "George Kiagiadakis" <kiagiadakis.george () gmail ! com>
Date:       2008-10-28 19:11:57
Message-ID: ba4a6e220810281211s2936b7cme3150b483eb18e36 () mail ! gmail ! com
[Download RAW message or body]

2008/10/28, Michael Leupold <lemma@confuego.org>:
> Hi George,
>
>
>  On Tuesday 28 October 2008, George Kiagiadakis wrote:
>  > >  Kopete uses a function static instance of its Kopete::WalletManager
>  > > (which in turn uses KWallet::Wallet) to manage the connection to the
>  > > wallet. If there's an open wallet connection on quitting kopete it is
>  > > closed in
>  > >  Kopete::WalletManager's dtor. Unfortunately the static destruction
>  > > sequence might destroy KWallet::Wallet's static dbus interface before
>  > > Kopete gets to closing the wallet.
>
> > How about a K_GLOBAL_STATIC? Something like this:
>  >
>  > K_GLOBAL_STATIC(Kopete::WalletManager, static_walletManager)
>  > Kopete::WalletManager *Kopete::WalletManager::self()
>  > {
>  >       return static_walletManager;
>  > }
>  >
>  > This should be safer imho, because I am not sure if connecting
>  > QCoreApplication::aboutToQuit() to WalletManager::deleteLater() will
>  > actually delete the object, as the time aboutToQuit() is emited, the
>  > eventloop is exiting and deleteLater() deletes the object the next
>  > time the event loop is run.
>
>
> That's what KWallet::Wallet is using. I think I tried that one but it doesn't
>  guarantee the destruction order, so if you have
>  K_GLOBAL_STATIC(A, globalA)
>  K_GLOBAL_STATIC(B, globalB)
>  in different files you have no guarantee as to which is destructed first.
>
>  Regards,
>
> Michael

Ah, now I understand what the problem really is... I am sorry, my mistake.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic