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.
This commit is contained in:
moneromooo-monero 2016-01-30 23:33:38 +00:00
parent b91fc2dc3c
commit 2cf8b32229
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -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)