diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-04-15 17:38:25 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-04-18 12:49:41 +0200 |
commit | 55a1db4fa2cf62b9766ef382c1e14b3ecbdf67fe (patch) | |
tree | 1ff19f533ab0221e27dd16c3d401c4d54dfbca7b /src/qt/clientmodel.cpp | |
parent | e07c943ce8df6c6cb3ece3fc676911ddb43ca184 (diff) |
Solve chainActive-related locking issues
- In wallet and GUI code LOCK cs_main as well as cs_wallet when
necessary
- In main.cpp SendMessages move the TRY_LOCK(cs_main) up, to encompass the call
to IsInitialBlockDownload.
- Make ActivateBestChain, AddToBlockIndex, IsInitialBlockDownload,
InitBlockIndex acquire the cs_main lock
Fixes #3997
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r-- | src/qt/clientmodel.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index cb832fdd42..287296644c 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -55,6 +55,7 @@ int ClientModel::getNumConnections(unsigned int flags) const int ClientModel::getNumBlocks() const { + LOCK(cs_main); return chainActive.Height(); } @@ -76,6 +77,7 @@ quint64 ClientModel::getTotalBytesSent() const QDateTime ClientModel::getLastBlockDate() const { + LOCK(cs_main); if (chainActive.Tip()) return QDateTime::fromTime_t(chainActive.Tip()->GetBlockTime()); else @@ -84,6 +86,7 @@ QDateTime ClientModel::getLastBlockDate() const double ClientModel::getVerificationProgress() const { + LOCK(cs_main); return Checkpoints::GuessVerificationProgress(chainActive.Tip()); } |