[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [networkmanagement/nm09] libs/service: According to kwallet.h we
From: "Lamarque V. Souza" <lamarque () gmail ! com>
Date: 2011-09-30 21:23:11
Message-ID: 20110930212311.6AE38A60A6 () git ! kde ! org
[Download RAW message or body]
Git commit 305c46b4ac4912b67713922032af1bf94bc1d6bf by Lamarque V. Souza.
Committed on 30/09/2011 at 23:21.
Pushed by lvsouza into branch 'nm09'.
According to kwallet.h we must delete the wallet object after using it.
M +11 -3 libs/service/secretstorage.cpp
http://commits.kde.org/networkmanagement/305c46b4ac4912b67713922032af1bf94bc1d6bf
diff --git a/libs/service/secretstorage.cpp b/libs/service/secretstorage.cpp
index 96cfbb6..0b91333 100644
--- a/libs/service/secretstorage.cpp
+++ b/libs/service/secretstorage.cpp
@@ -96,8 +96,8 @@ void SecretStorage::saveSecrets(Knm::Connection *con)
void SecretStorage::walletOpenedForWrite(bool success)
{
Q_D(SecretStorage);
+ KWallet::Wallet * wallet = static_cast<KWallet::Wallet*>(sender());
if (success) {
- KWallet::Wallet * wallet = static_cast<KWallet::Wallet*>(sender());
if (wallet->isOpen()) {
bool readyForWalletWrite = false;
if( !wallet->hasFolder( s_walletFolderName ) )
@@ -113,7 +113,7 @@ void SecretStorage::walletOpenedForWrite(bool success)
if (k.startsWith(con->uuid() + ';')) {
kDebug() << "Removing entry " << k << ")";
wallet->removeEntry(k);
- }
+ }
}
foreach (Knm::Setting * setting, con->settings()) {
QMap<QString,QString> map = setting->secretsToMap();
@@ -131,6 +131,7 @@ void SecretStorage::walletOpenedForWrite(bool success)
}
}
}
+ delete wallet;
}
void SecretStorage::walletOpenedForRead(bool success)
@@ -138,8 +139,8 @@ void SecretStorage::walletOpenedForRead(bool success)
Q_D(SecretStorage);
kDebug();
bool retrievalSuccessful = true;
+ KWallet::Wallet * wallet = static_cast<KWallet::Wallet*>(sender());
if (success) {
- KWallet::Wallet * wallet = static_cast<KWallet::Wallet*>(sender());
if (wallet->isOpen() && wallet->hasFolder(s_walletFolderName) && \
wallet->setFolder(s_walletFolderName)) { while (!d->connectionsToRead.isEmpty()) {
Knm::Connection *con = d->connectionsToRead.takeFirst();
@@ -176,6 +177,8 @@ void SecretStorage::walletOpenedForRead(bool success)
retrievalSuccessful = false;
}
}
+ delete wallet;
+
if (!retrievalSuccessful || !success) {
while (!d->connectionsToRead.isEmpty()) {
Knm::Connection *con = d->connectionsToRead.takeFirst();
@@ -211,6 +214,10 @@ void SecretStorage::deleteSecrets(Knm::Connection *con)
wallet->removeEntry(k);
}
}
+
+ if (wallet) {
+ delete wallet;
+ }
}
}
@@ -329,4 +336,5 @@ void SecretStorage::switchStorage(SecretStorageMode oldMode, \
SecretStorageMode n wallet->removeEntry(key);
}
}
+ delete wallet;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic