File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 34
34
35
35
#include < boost/algorithm/string/replace.hpp>
36
36
37
- static std::vector<CWallet*> vpwallets;
37
+ static CCriticalSection cs_wallets;
38
+ static std::vector<CWallet*> vpwallets GUARDED_BY (cs_wallets);
38
39
39
40
bool AddWallet (CWallet* wallet)
40
41
{
42
+ LOCK (cs_wallets);
41
43
assert (wallet);
42
44
std::vector<CWallet*>::const_iterator i = std::find (vpwallets.begin (), vpwallets.end (), wallet);
43
45
if (i != vpwallets.end ()) return false ;
@@ -47,6 +49,7 @@ bool AddWallet(CWallet* wallet)
47
49
48
50
bool RemoveWallet (CWallet* wallet)
49
51
{
52
+ LOCK (cs_wallets);
50
53
assert (wallet);
51
54
std::vector<CWallet*>::iterator i = std::find (vpwallets.begin (), vpwallets.end (), wallet);
52
55
if (i == vpwallets.end ()) return false ;
@@ -56,16 +59,19 @@ bool RemoveWallet(CWallet* wallet)
56
59
57
60
bool HasWallets ()
58
61
{
62
+ LOCK (cs_wallets);
59
63
return !vpwallets.empty ();
60
64
}
61
65
62
66
std::vector<CWallet*> GetWallets ()
63
67
{
68
+ LOCK (cs_wallets);
64
69
return vpwallets;
65
70
}
66
71
67
72
CWallet* GetWallet (const std::string& name)
68
73
{
74
+ LOCK (cs_wallets);
69
75
for (CWallet* wallet : vpwallets) {
70
76
if (wallet->GetName () == name) return wallet;
71
77
}
You can’t perform that action at this time.
0 commit comments