From 867b6efe4d1cbdd383db77d84a47dd23b9ae5829 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 13 Oct 2020 14:42:09 +0200 Subject: [PATCH] Merge bitcoin-core/gui#102: Fix SplashScreen crash when run with -disablewallet c056064a4a93be3601a63b37afea41f8b878df79 gui: Fix SplashScreen crash when run with -disablewallet (Hennadii Stepanov) Pull request description: This PR fixes the bug introduced in https://github.com/bitcoin/bitcoin/pull/19099: ``` $ src/qt/bitcoin-qt -disablewallet bitcoin-qt: interfaces/node.cpp:236: auto interfaces::(anonymous namespace)::NodeImpl::walletClient()::(anonymous class)::operator()() const: Assertion `"m_context->wallet_client" && check' failed. Aborted (core dumped) ``` ACKs for top commit: Sjors: tACK c056064 promag: ACK c056064a4a93be3601a63b37afea41f8b878df79. Tree-SHA512: 263d9efd5899cc6e447dfc5142bf911ca627149fac0a1c5e5b58dd196aa5e0d12fe13e3f750fb5f3c4338222f7959935d2f77391263f967dbca2e0e79a416a29 --- src/qt/splashscreen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 196112d07a..34daf82c4e 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -187,6 +188,7 @@ void SplashScreen::subscribeToCoreSignals() void SplashScreen::handleLoadWallet() { #ifdef ENABLE_WALLET + if (!WalletModel::isWalletEnabled()) return; m_handler_load_wallet = m_node.walletClient().handleLoadWallet([this](std::unique_ptr wallet) { m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2, false))); m_connected_wallets.emplace_back(std::move(wallet)); @@ -200,7 +202,9 @@ void SplashScreen::unsubscribeFromCoreSignals() m_handler_init_message->disconnect(); m_handler_show_progress->disconnect(); #ifdef ENABLE_WALLET - m_handler_load_wallet->disconnect(); + if (m_handler_load_wallet != nullptr) { + m_handler_load_wallet->disconnect(); + } #endif // ENABLE_WALLET for (const auto& handler : m_connected_wallet_handlers) { handler->disconnect();