From 5e9b555fed49c7ae5ebd710e3ac6ab60c176d561 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 3 Nov 2016 21:28:56 -0700 Subject: [PATCH] Fixes #1762 segfault when miner is interrupted. Running ./zcash-cli setgenerate false would result in a segfault. The miner thread's boost::signals2::connection was not disconnected when the miner thread was interrupted and shutdown. Subsequently, when a new block arrived, the UpdateTip callback would still be invoked on a now invalid object, resulting in a segfault. --- src/miner.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/miner.cpp b/src/miner.cpp index ddab39f74..85d4a3d01 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -647,11 +647,13 @@ void static BitcoinMiner(CWallet *pwallet) } catch (const boost::thread_interrupted&) { + c.disconnect(); LogPrintf("ZcashMiner terminated\n"); throw; } catch (const std::runtime_error &e) { + c.disconnect(); LogPrintf("ZcashMiner runtime error: %s\n", e.what()); return; }