aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/init.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-05-22 16:18:07 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-05-22 16:56:20 +0100
commit80b4910f7d87983f50047074c3c2397b0a5c4e92 (patch)
tree0bd471d1bc9b659b52033bd333cfe9b433e9b4e1 /src/wallet/init.cpp
parent6916024768ec57a00f54224640ab4e4871d2a30a (diff)
wallet: Use shared pointer to retain wallet instance
Diffstat (limited to 'src/wallet/init.cpp')
-rw-r--r--src/wallet/init.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp
index 5cfa864512..237bca7e5d 100644
--- a/src/wallet/init.cpp
+++ b/src/wallet/init.cpp
@@ -226,7 +226,7 @@ bool WalletInit::Open() const
}
for (const std::string& walletFile : gArgs.GetArgs("-wallet")) {
- CWallet * const pwallet = CWallet::CreateWalletFromFile(walletFile, fs::absolute(walletFile, GetWalletDir()));
+ std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(walletFile, fs::absolute(walletFile, GetWalletDir()));
if (!pwallet) {
return false;
}
@@ -238,7 +238,7 @@ bool WalletInit::Open() const
void WalletInit::Start(CScheduler& scheduler) const
{
- for (CWallet* pwallet : GetWallets()) {
+ for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
pwallet->postInitProcess();
}
@@ -248,22 +248,21 @@ void WalletInit::Start(CScheduler& scheduler) const
void WalletInit::Flush() const
{
- for (CWallet* pwallet : GetWallets()) {
+ for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
pwallet->Flush(false);
}
}
void WalletInit::Stop() const
{
- for (CWallet* pwallet : GetWallets()) {
+ for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
pwallet->Flush(true);
}
}
void WalletInit::Close() const
{
- for (CWallet* pwallet : GetWallets()) {
+ for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
RemoveWallet(pwallet);
- delete pwallet;
}
}