Skip to content

Commit d2ac748

Browse files
committed
Merge #864: Crash fix, disconnect numBlocksChanged() signal during shutdown
71656bd gui: crash fix, disconnect numBlocksChanged() signal during shutdown (furszy) Pull request description: Aiming to fix #862. The crash stems from the order of the shutdown procedure: We first unset the client model, then destroy the wallet controller—but we leave the internal wallet models (`m_wallets`) untouched for a brief period. As a result, there’s a point in time where views still have connected signals and access to wallet models that are not connected to any wallet controller. Now.. since the `clientModel` is only replaced with nullptr locally and not destroyed yet, signals like `numBlocksChanged` can still emit. Thus, when wallet views receive them, they see a non-null wallet model ptr, and proceed to call backend functions from a model that is being torn down. As the shutdown procedure begins by unsetting `clientModel` from all views. It’s safe to ignore events when `clientModel` is nullptr. ACKs for top commit: maflcko: lgtm ACK 71656bd pablomartin4btc: re-ACK 71656bd hebasto: ACK 71656bd, I have reviewed the code and it looks OK. Tree-SHA512: e6a369c40aad8a5a3da64e92daa10250006f60c53feef353a5580e1bdb17fe8e1ad102abf5419ddeff1caa703b69ab634265ef3b9cfef87e9304f97bfdd2c4aa
2 parents de90b47 + 71656bd commit d2ac748

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,10 @@ void SendCoinsDialog::updateCoinControlState()
855855
}
856856

857857
void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state) {
858+
// During shutdown, clientModel will be nullptr. Attempting to update views at this point may cause a crash
859+
// due to accessing backend models that might no longer exist.
860+
if (!clientModel) return;
861+
// Process event
858862
if (sync_state == SynchronizationState::POST_INIT) {
859863
updateSmartFeeLabel();
860864
}

0 commit comments

Comments
 (0)