Skip to content

Commit

Permalink
Check m_internals in UnregisterValidationInterface
Browse files Browse the repository at this point in the history
When a wallet is created it is registered in the validation interface (in
CWallet::CreateWalletFromFile) but it is not immediately added to the
wallets list. If a shutdown is requested before AddWallet (case more
evident when -rescan is set) then m_internals can be released (in
Shutdown -> UnregisterBackgroundSignalScheduler) before the wallet and
then ReleaseWallet would call UnregisterValidationInterface with
m_internals already released.
  • Loading branch information
promag committed Feb 3, 2019
1 parent fd6d499 commit 0dd6a8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/validationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
}

void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
g_signals.m_internals->m_connMainSignals.erase(pwalletIn);
if (g_signals.m_internals) {
g_signals.m_internals->m_connMainSignals.erase(pwalletIn);
}
}

void UnregisterAllValidationInterfaces() {
Expand Down

0 comments on commit 0dd6a8c

Please sign in to comment.