diff options
author | Chun Kuan Lee <ken2812221@gmail.com> | 2018-10-17 23:12:28 +0800 |
---|---|---|
committer | Chun Kuan Lee <ken2812221@gmail.com> | 2018-10-20 02:29:35 +0800 |
commit | 2196c51821e340c9a9d2c76c30f9402370f84994 (patch) | |
tree | 5f8b06f76be254788b30eda7af008da0abc8417d /src/validation.cpp | |
parent | be992701b018f256db6d64786624be4cb60d8975 (diff) |
refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 458458d85d..db7b249ffc 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2368,14 +2368,11 @@ class ConnectTrace { private: std::vector<PerBlockConnectTrace> blocksConnected; CTxMemPool &pool; + boost::signals2::scoped_connection m_connNotifyEntryRemoved; public: explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) { - pool.NotifyEntryRemoved.connect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); - } - - ~ConnectTrace() { - pool.NotifyEntryRemoved.disconnect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); + m_connNotifyEntryRemoved = pool.NotifyEntryRemoved.connect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); } void BlockConnected(CBlockIndex* pindex, std::shared_ptr<const CBlock> pblock) { |