From d5046e72f4180b7932368919ae08da24be8e9583 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Mon, 20 Mar 2017 12:27:07 -0400 Subject: [PATCH 1/2] Avoid scoped_connection compile error with boost 1.55.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 in https://github.com/bitcoin/bitcoin/pull/9974#issuecomment-287550034 --- src/qt/test/wallettests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 2bb7f01fd..118b54e8d 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -42,9 +42,9 @@ uint256 SendCoins(CWallet& wallet, SendCoinsDialog& sendCoinsDialog, const CBitc entry->findChild("payTo")->setText(QString::fromStdString(address.ToString())); entry->findChild("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; From b5bec4e330fc7201d989663b4dbc6a1e620dd0f9 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Mon, 20 Mar 2017 12:35:37 -0400 Subject: [PATCH 2/2] Avoid QTimer::singleShot compile error with Qt 5.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Construct QTimer object directly, instead of relying on QTimer::singleShot overloads accepting lambdas, which weren't introduced until Qt 5.4. Avoids the following compile error in debian jessie: ``` qt/test/wallettests.cpp: In function ‘void {anonymous}::ConfirmSend()’: qt/test/wallettests.cpp:34:6: error: no matching function for call to ‘QTimer::singleShot(int, Qt::TimerType, {anonymous}::ConfirmSend()::)’ }); ^ qt/test/wallettests.cpp:34:6: note: candidates are: In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTimer:1:0, from ./qt/sendcoinsdialog.h:13, from qt/test/wallettests.cpp:7: /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:81:17: note: static void QTimer::singleShot(int, const QObject*, const char*) static void singleShot(int msec, const QObject *receiver, const char *member); ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:81:17: note: no known conversion for argument 2 from ‘Qt::TimerType’ to ‘const QObject*’ /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:82:17: note: static void QTimer::singleShot(int, Qt::TimerType, const QObject*, const char*) static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member); ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:82:17: note: candidate expects 4 arguments, 3 provided ``` Error reported by Pavel Janík in https://github.com/bitcoin/bitcoin/pull/9974#issuecomment-287574436 --- src/qt/test/wallettests.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 118b54e8d..36d93361d 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -22,7 +22,9 @@ namespace //! Press "Yes" button in modal send confirmation dialog. void ConfirmSend() { - QTimer::singleShot(0, Qt::PreciseTimer, []() { + QTimer* timer = new QTimer; + timer->setSingleShot(true); + QObject::connect(timer, &QTimer::timeout, []() { for (QWidget* widget : QApplication::topLevelWidgets()) { if (widget->inherits("SendConfirmationDialog")) { SendConfirmationDialog* dialog = qobject_cast(widget); @@ -32,6 +34,7 @@ void ConfirmSend() } } }); + timer->start(0); } //! Send coins to address and return txid.