Skip to content

Commit 1971f5b

Browse files
committed
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
1 parent cb35f1d commit 1971f5b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/validationinterface.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <list>
1515
#include <atomic>
1616
#include <future>
17+
#include <utility>
1718

1819
#include <boost/signals2/signal.hpp>
1920

@@ -77,7 +78,10 @@ size_t CMainSignals::CallbacksPending() {
7778
}
7879

7980
void CMainSignals::RegisterWithMempoolSignals(CTxMemPool& pool) {
80-
g_connNotifyEntryRemoved.emplace(&pool, pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::MempoolEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)));
81+
g_connNotifyEntryRemoved.emplace(std::piecewise_construct,
82+
std::forward_as_tuple(&pool),
83+
std::forward_as_tuple(pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::MempoolEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)))
84+
);
8185
}
8286

8387
void CMainSignals::UnregisterWithMempoolSignals(CTxMemPool& pool) {

0 commit comments

Comments
 (0)