mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-16 23:53:29 +01:00
gui: guard accessing a nullptr 'clientModel'
During shutdown, already queue events dispatched from the backend such 'numConnectionsChanged' and 'networkActiveChanged' could try to access the clientModel object, which might not exist because we manually delete it inside 'BitcoinApplication::requestShutdown()'.
This commit is contained in:
@@ -372,6 +372,11 @@ void BitcoinApplication::requestShutdown()
|
||||
// Request node shutdown, which can interrupt long operations, like
|
||||
// rescanning a wallet.
|
||||
node().startShutdown();
|
||||
// Prior to unsetting the client model, stop listening backend signals
|
||||
if (clientModel) {
|
||||
clientModel->stop();
|
||||
}
|
||||
|
||||
// Unsetting the client model can cause the current thread to wait for node
|
||||
// to complete an operation, like wait for a RPC execution to complete.
|
||||
window->setClientModel(nullptr);
|
||||
|
||||
Reference in New Issue
Block a user