@@ -899,6 +899,10 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller)
899
899
900
900
GUIUtil::ExceptionSafeConnect (wallet_controller, &WalletController::walletAdded, this , &BitcoinGUI::addWallet);
901
901
connect (wallet_controller, &WalletController::walletRemoved, this , &BitcoinGUI::removeWallet);
902
+ connect (wallet_controller, &WalletController::destroyed, this , [this ] {
903
+ // wallet_controller gets destroyed manually, but it leaves our member copy dangling
904
+ m_wallet_controller = nullptr ;
905
+ });
902
906
903
907
auto activity = new LoadWalletsActivity (m_wallet_controller, this );
904
908
activity->load ();
@@ -911,7 +915,7 @@ WalletController* BitcoinGUI::getWalletController()
911
915
912
916
void BitcoinGUI::addWallet (WalletModel* walletModel)
913
917
{
914
- if (!walletFrame) return ;
918
+ if (!walletFrame || !m_wallet_controller ) return ;
915
919
916
920
WalletView* wallet_view = new WalletView (walletModel, walletFrame);
917
921
if (!walletFrame->addView (wallet_view)) return ;
@@ -959,7 +963,7 @@ void BitcoinGUI::removeWallet(WalletModel* walletModel)
959
963
960
964
void BitcoinGUI::setCurrentWallet (WalletModel* wallet_model)
961
965
{
962
- if (!walletFrame) return ;
966
+ if (!walletFrame || !m_wallet_controller ) return ;
963
967
walletFrame->setCurrentWallet (wallet_model);
964
968
for (int index = 0 ; index < m_wallet_selector->count (); ++index ) {
965
969
if (m_wallet_selector->itemData (index ).value <WalletModel*>() == wallet_model) {
0 commit comments