Skip to content

Commit

Permalink
Piecewise construct to avoid invalid construction
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Empact committed Feb 1, 2019
1 parent cb35f1d commit 1971f5b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/validationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <list>
#include <atomic>
#include <future>
#include <utility>

#include <boost/signals2/signal.hpp>

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1971f5b

Please sign in to comment.