mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 15:39:05 +01:00
Fix wallet unload race condition
Currently it's possible for ReleaseWallet to delete the CWallet pointer while it is processing BlockConnected, etc chain notifications. To fix this, unregister from notifications earlier in UnloadWallet instead of ReleaseWallet, and use a new RegisterSharedValidationInterface function to prevent the CValidationInterface shared_ptr from being deleted until the last notification is actually finished.
This commit is contained in:
committed by
João Barbosa
parent
3e50fdbe4e
commit
ab31b9d6fe
@@ -229,7 +229,7 @@ public:
|
||||
};
|
||||
|
||||
//! Register handler for notifications.
|
||||
virtual std::unique_ptr<Handler> handleNotifications(Notifications& notifications) = 0;
|
||||
virtual std::unique_ptr<Handler> handleNotifications(std::shared_ptr<Notifications> notifications) = 0;
|
||||
|
||||
//! Wait for pending notifications to be processed unless block hash points to the current
|
||||
//! chain tip.
|
||||
|
||||
Reference in New Issue
Block a user