aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/chain.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-03-10 15:46:20 -0400
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-03-27 15:17:35 +0000
commitab31b9d6fe7b39713682e3f52d11238dbe042c16 (patch)
treef719291130d3322eaac867b793309f476d8872c1 /src/interfaces/chain.h
parent3e50fdbe4e5bb98194e88023468bd77dee78b26e (diff)
downloadbitcoin-ab31b9d6fe7b39713682e3f52d11238dbe042c16.tar.xz
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.
Diffstat (limited to 'src/interfaces/chain.h')
-rw-r--r--src/interfaces/chain.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index caefa87e11..e1bc9bbbf3 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -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.