aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-01-30 23:33:38 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-01-30 23:34:23 +0000
commit2cf8b32229966094570c564d03c66c2603b631cc (patch)
treed39697a4854ff1fc89c4ea088e59681da7f1f216 /src
parentMerge pull request #629 (diff)
downloadmonero-2cf8b32229966094570c564d03c66c2603b631cc.tar.xz
wallet: guard against exception in process_blocks
If an exception occurs, the thread needs to be joined, or it will be deleted while still live, and terminate the process.
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index d636b0e4b..06cf67e32 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -701,7 +701,15 @@ void wallet2::refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& re
bool error = false;
pull_thread = std::thread([&]{pull_next_blocks(start_height, next_blocks_start_height, short_chain_history, blocks, next_blocks, error);});
- process_blocks(blocks_start_height, blocks, added_blocks);
+ try
+ {
+ process_blocks(blocks_start_height, blocks, added_blocks);
+ }
+ catch (...)
+ {
+ pull_thread.join();
+ throw;
+ }
blocks_fetched += added_blocks;
pull_thread.join();
if(!added_blocks)