Skip to content

Commit

Permalink
Avoid scoped_connection compile error with boost 1.55.0
Browse files Browse the repository at this point in the history
Construct scoped_connection directly instead of relying on copy initialization
and move constructor. Avoids the following compile error in debian jessie:

```
In file included from /usr/include/boost/signals2/signal.hpp:21:0,
                 from ./util.h:29,
                 from ./dbwrapper.h:11,
                 from ./txdb.h:10,
                 from ./test/test_bitcoin.h:11,
                 from qt/test/wallettests.cpp:11:
/usr/include/boost/signals2/connection.hpp: In function ‘uint256 {anonymous}::SendCoins(CWallet&, SendCoinsDialog&, const CBitcoinAddress&, CAmount)’:
/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);
       ^
qt/test/wallettests.cpp:47:6: error: within this context
     });
      ^
```

Error reported by Pavel Janík <Pavel@Janik.cz> in
bitcoin#9974 (comment)
  • Loading branch information
ryanofsky committed Mar 20, 2017
1 parent d34995a commit d5046e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/qt/test/wallettests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ uint256 SendCoins(CWallet& wallet, SendCoinsDialog& sendCoinsDialog, const CBitc
entry->findChild<QValidatedLineEdit*>("payTo")->setText(QString::fromStdString(address.ToString()));
entry->findChild<BitcoinAmountField*>("payAmount")->setValue(amount);
uint256 txid;
boost::signals2::scoped_connection c = wallet.NotifyTransactionChanged.connect([&txid](CWallet*, const uint256& hash, ChangeType status) {
boost::signals2::scoped_connection c(wallet.NotifyTransactionChanged.connect([&txid](CWallet*, const uint256& hash, ChangeType status) {
if (status == CT_NEW) txid = hash;
});
}));
ConfirmSend();
QMetaObject::invokeMethod(&sendCoinsDialog, "on_sendButton_clicked");
return txid;
Expand Down

0 comments on commit d5046e7

Please sign in to comment.