diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-04-09 13:25:17 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-04-09 13:25:17 -0700 |
commit | 1a275bac2b5454ae9d6744f28c29cbf40e2fbf13 (patch) | |
tree | 4cf7a1b4001ef82c15f4942f6a495aaf530c7d0e /src/qt/walletmodel.cpp | |
parent | 1044391135b9d2e309c1e960afc72afa2a7e04f5 (diff) | |
parent | f342dac1cb06d5b0d264fa59e448ef6477ec5b6b (diff) |
Merge pull request #1052 from sipa/scopedlocks
Use scoped locks instead of CRITICAL_BLOCK
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r-- | src/qt/walletmodel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 6cc023792d..9c28a8abc8 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -32,8 +32,8 @@ qint64 WalletModel::getUnconfirmedBalance() const int WalletModel::getNumTransactions() const { int numTransactions = 0; - CRITICAL_BLOCK(wallet->cs_wallet) { + LOCK(wallet->cs_wallet); numTransactions = wallet->mapWallet.size(); } return numTransactions; @@ -115,9 +115,9 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie return SendCoinsReturn(AmountWithFeeExceedsBalance, nTransactionFee); } - CRITICAL_BLOCK(cs_main) - CRITICAL_BLOCK(wallet->cs_wallet) { + LOCK2(cs_main, wallet->cs_wallet); + // Sendmany std::vector<std::pair<CScript, int64> > vecSend; foreach(const SendCoinsRecipient &rcp, recipients) @@ -155,8 +155,8 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie foreach(const SendCoinsRecipient &rcp, recipients) { std::string strAddress = rcp.address.toStdString(); - CRITICAL_BLOCK(wallet->cs_wallet) { + LOCK(wallet->cs_wallet); if (!wallet->mapAddressBook.count(strAddress)) wallet->SetAddressBookName(strAddress, rcp.label.toStdString()); } @@ -227,8 +227,8 @@ bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase) bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureString &newPass) { bool retval; - CRITICAL_BLOCK(wallet->cs_wallet) { + LOCK(wallet->cs_wallet); wallet->Lock(); // Make sure wallet is locked before attempting pass change retval = wallet->ChangeWalletPassphrase(oldPass, newPass); } |