diff options
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r-- | src/qt/bitcoingui.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 0eae7d3e79..d26ef52eb4 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -689,6 +689,10 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller) GUIUtil::ExceptionSafeConnect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet); connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet); + connect(wallet_controller, &WalletController::destroyed, this, [this] { + // wallet_controller gets destroyed manually, but it leaves our member copy dangling + m_wallet_controller = nullptr; + }); auto activity = new LoadWalletsActivity(m_wallet_controller, this); activity->load(); @@ -701,7 +705,7 @@ WalletController* BitcoinGUI::getWalletController() void BitcoinGUI::addWallet(WalletModel* walletModel) { - if (!walletFrame) return; + if (!walletFrame || !m_wallet_controller) return; WalletView* wallet_view = new WalletView(walletModel, platformStyle, walletFrame); if (!walletFrame->addView(wallet_view)) return; @@ -753,7 +757,7 @@ void BitcoinGUI::removeWallet(WalletModel* walletModel) void BitcoinGUI::setCurrentWallet(WalletModel* wallet_model) { - if (!walletFrame) return; + if (!walletFrame || !m_wallet_controller) return; walletFrame->setCurrentWallet(wallet_model); for (int index = 0; index < m_wallet_selector->count(); ++index) { if (m_wallet_selector->itemData(index).value<WalletModel*>() == wallet_model) { |