mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-14 06:32:33 +01:00
Fix segfault when shutdown during wallet open
If you open a wallet and send a shutdown signal during that process, the GUI will segfault due to some queued wallet events happening after the wallet controller is deleted. This is a minimal fix for those issues.
This commit is contained in:
@@ -680,6 +680,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();
|
||||
@@ -692,7 +696,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;
|
||||
@@ -742,7 +746,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) {
|
||||
|
||||
Reference in New Issue
Block a user