Forwarding to kopete-devel. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
--- Begin Message ---Hi,since I made kwalletd a binary of its own KWallet::Wallet makes sure the daemon is started if any application needs its service. It also maintains a static pointer to the dbus interface. That's where the actual fun starts. 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. Now the main problem is that Kopete's connection to the wallet is never terminated leaving the wallet open unless the user has configured a timer to close it after a specified interval. To fix this I made a patch for kopete some while ago (attached). It changes the WalletManager instance from function static to a static class member. Destruction is handled by connecting the aboutToQuit() signal to the instance's deleteLater() slot. Now I figure this might not be the prettiest but do you think that's ok? I wouldn't mind if someone came up with a more elegant way either. Regards, MichaelIndex: libkopete/kopetewalletmanager.h =================================================================== --- libkopete/kopetewalletmanager.h (Revision 824255) +++ libkopete/kopetewalletmanager.h (Arbeitskopie) @@ -91,6 +91,8 @@ void openWalletInner(); void emitWalletOpened( KWallet::Wallet *wallet ); + static WalletManager *s; + class Private; Private *d; Index: libkopete/kopetewalletmanager.cpp =================================================================== --- libkopete/kopetewalletmanager.cpp (Revision 824255) +++ libkopete/kopetewalletmanager.cpp (Arbeitskopie) @@ -50,6 +50,8 @@ KopeteWalletSignal *signal; }; +Kopete::WalletManager *Kopete::WalletManager::s = 0; + Kopete::WalletManager::WalletManager() : d( new Private ) { @@ -63,8 +65,11 @@ Kopete::WalletManager *Kopete::WalletManager::self() { - static WalletManager s; - return &s; + if (!s) { + s = new WalletManager(); + connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), s, SLOT(deleteLater())); + } + return s; } void Kopete::WalletManager::openWallet( QObject *object, const char *slot )
signature.asc
Description: This is a digitally signed message part.>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
--- End Message ---
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ kopete-devel mailing list kopete-devel@kde.org https://mail.kde.org/mailman/listinfo/kopete-devel