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.
This commit is contained in:
@@ -647,11 +647,13 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
}
|
}
|
||||||
catch (const boost::thread_interrupted&)
|
catch (const boost::thread_interrupted&)
|
||||||
{
|
{
|
||||||
|
c.disconnect();
|
||||||
LogPrintf("ZcashMiner terminated\n");
|
LogPrintf("ZcashMiner terminated\n");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (const std::runtime_error &e)
|
catch (const std::runtime_error &e)
|
||||||
{
|
{
|
||||||
|
c.disconnect();
|
||||||
LogPrintf("ZcashMiner runtime error: %s\n", e.what());
|
LogPrintf("ZcashMiner runtime error: %s\n", e.what());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user