aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpracticalswift <[email protected]>2017-08-09 15:01:54 +0200
committerpracticalswift <[email protected]>2017-11-09 16:52:44 +0100
commit860e912583b48fef7dc5b0399c40a7696ccfec55 (patch)
tree6cdcdbe99178428aedfabe550d59302c0f850ee3
parentMerge #11074: Assert that CWallet::SyncMetaData finds oldest transaction. (diff)
downloaddiscoin-860e912583b48fef7dc5b0399c40a7696ccfec55.tar.xz
discoin-860e912583b48fef7dc5b0399c40a7696ccfec55.zip
Use unique_ptr for pwalletMain (CWallet)
-rw-r--r--src/wallet/test/wallet_test_fixture.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/wallet/test/wallet_test_fixture.cpp b/src/wallet/test/wallet_test_fixture.cpp
index e2f48c45a..0dd21171c 100644
--- a/src/wallet/test/wallet_test_fixture.cpp
+++ b/src/wallet/test/wallet_test_fixture.cpp
@@ -8,7 +8,7 @@
#include "wallet/db.h"
#include "wallet/wallet.h"
-CWallet *pwalletMain;
+std::unique_ptr<CWallet> pwalletMain;
WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
TestingSetup(chainName)
@@ -17,18 +17,17 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
bool fFirstRun;
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
- pwalletMain = new CWallet(std::move(dbw));
+ pwalletMain = std::unique_ptr<CWallet>(new CWallet(std::move(dbw)));
pwalletMain->LoadWallet(fFirstRun);
- RegisterValidationInterface(pwalletMain);
+ RegisterValidationInterface(pwalletMain.get());
RegisterWalletRPCCommands(tableRPC);
}
WalletTestingSetup::~WalletTestingSetup()
{
- UnregisterValidationInterface(pwalletMain);
- delete pwalletMain;
- pwalletMain = nullptr;
+ UnregisterValidationInterface(pwalletMain.get());
+ pwalletMain.reset();
bitdb.Flush(true);
bitdb.Reset();