[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#372564: kwalletmanager very often crashes at KDE Logout



It looks like a problem with a patch in Debian's kdeutils branch update 
(r548145).

Under certain circumstances, kwalletmanager exits and deletes _dcopRef 
before it's actually been created.  We just need to create _dcopRef 
earlier.  I've attached a slight modification to the patch that seems to 
fix it for me.

John
--- kwallet/kwalletmanager.cpp
+++ kwallet/kwalletmanager.cpp
@@ -55,22 +55,31 @@
 	_shuttingDown = false;
 	KConfig cfg("kwalletrc"); // not sure why this setting isn't in kwalletmanagerrc...
 	KConfigGroup walletConfigGroup(&cfg, "Wallet");
+	_dcopRef = new DCOPRef("kded", "kwalletd");
 	if (walletConfigGroup.readBoolEntry("Launch Manager", true)) {
 		_tray = new KSystemTray(this, "kwalletmanager tray");
 		_tray->setPixmap(loadSystemTrayIcon("wallet_closed"));
 		QToolTip::add(_tray, i18n("KDE Wallet: No wallets open."));
-		connect(_tray,SIGNAL(quitSelected()),SLOT(shuttingDown()));
+		connect(_tray, SIGNAL(quitSelected()), SLOT(shuttingDown()));
 		QStringList wl = KWallet::Wallet::walletList();
+		bool isOpen = false;
 		for (QStringList::Iterator it = wl.begin(); it != wl.end(); ++it) {
 			if (KWallet::Wallet::isOpen(*it)) {
 				_tray->setPixmap(loadSystemTrayIcon("wallet_open"));
 				QToolTip::remove(_tray);
 				QToolTip::add(_tray, i18n("KDE Wallet: A wallet is open."));
+				isOpen = true;
 				break;
 			}
 		}
+		if (!isOpen && kapp->isRestored()) {
+			delete _tray;
+			_tray = 0L;
+			kapp->exit();
+			return;
+		}
 	} else {
-		_tray = 0;
+		_tray = 0L;
 	}
 
 	_iconView = new KWalletIconView(this, "kwalletmanager icon view");
@@ -81,7 +90,6 @@
 	setCentralWidget(_iconView);
 	_iconView->setMinimumSize(320, 200);
 
-	_dcopRef = new DCOPRef("kded", "kwalletd");
 	_dcopRef->dcopClient()->setNotifications(true);
 	connect(_dcopRef->dcopClient(),
 		SIGNAL(applicationRemoved(const QCString&)),

Reply to: