gui: Fix shutdown order
Summary:
- gui: Fix WalletController deletion
The wallet controller instanced must be deleted after the window instance
since it is used there.
- gui: Expose BitcoinGUI::unsubscribeFromCoreSignals
Move only change that makes unsubscribeFromCoreSignals public. It must be
called if the event loop is not running otherwise core signals handlers
can deadlock.
- gui: Fix m_node.startShutdown() order
This change forwards the shutdown request on the GUI (close the
application for instace) to the node as soon as possible. This way the
GUI doesn't have to wait for long operations to complete (rescan the
wallet for instance), instead those operations detect the shutdown
request and abort/interrupt.
- Check m_internals in UnregisterValidationInterface
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.
This is a backport of Core PR15280
Test Plan:
ninja all check-all
Run bitcoin-qt on win64 and verify it shuts down properly.
Reviewers: #bitcoin_abc, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Differential Revision: https://reviews.bitcoinabc.org/D6344