diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2018-12-30 14:19:14 -0800 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2019-01-31 22:10:54 -0800 |
commit | 1971f5ba04de9ac1e1a95d9f727e7bd4bc35dc88 (patch) | |
tree | fce7e30b23a09f607cc82fad02000dbd7e4f2b89 /src/validationinterface.cpp | |
parent | cb35f1d305d88934df64c2e7fb80700b673360e6 (diff) |
Piecewise construct to avoid invalid construction
In CMainSignals::RegisterWithMempoolSignals running under Ubuntu 14.04
(QT 5.2), absent piecewise construction this fails to create the pair
because the argument is a connection, which is converted into a
non-copyable scoped_connection.
validationinterface.cpp:80:186: required from here
/usr/include/boost/signals2/connection.hpp:234:7: error: ‘boost::signals2::scoped_connection::scoped_connection(const boost::signals2::scoped_connection&)’ is private
scoped_connection(const scoped_connection &other);
^
In file included from /usr/include/c++/4.8/utility:70:0,
from /usr/include/c++/4.8/algorithm:60,
from ./prevector.h:13,
from ./script/script.h:10,
from ./primitives/transaction.h:11,
from ./validationinterface.h:9,
from validationinterface.cpp:6:
/usr/include/c++/4.8/bits/stl_pair.h:134:45: error: within this context
: first(std::forward<_U1>(__x)), second(__y) { }
https://travis-ci.org/bitcoin/bitcoin/jobs/473689141#L2172
Diffstat (limited to 'src/validationinterface.cpp')
-rw-r--r-- | src/validationinterface.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 533d412888..2e13bef19e 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -14,6 +14,7 @@ #include <list> #include <atomic> #include <future> +#include <utility> #include <boost/signals2/signal.hpp> @@ -77,7 +78,10 @@ size_t CMainSignals::CallbacksPending() { } void CMainSignals::RegisterWithMempoolSignals(CTxMemPool& pool) { - g_connNotifyEntryRemoved.emplace(&pool, pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::MempoolEntryRemoved, this, std::placeholders::_1, std::placeholders::_2))); + g_connNotifyEntryRemoved.emplace(std::piecewise_construct, + std::forward_as_tuple(&pool), + std::forward_as_tuple(pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::MempoolEntryRemoved, this, std::placeholders::_1, std::placeholders::_2))) + ); } void CMainSignals::UnregisterWithMempoolSignals(CTxMemPool& pool) { |