From be82dea23c3e6931f9ae7ab8c6a8595ae950587f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Mon, 21 Jan 2019 16:57:22 +0000 Subject: gui: Add thread to run background activity in WalletController --- src/qt/walletcontroller.cpp | 8 +++++++- src/qt/walletcontroller.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 0730afca98..a103f4c89b 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -26,11 +26,17 @@ WalletController::WalletController(interfaces::Node& node, const PlatformStyle* for (std::unique_ptr& wallet : m_node.getWallets()) { getOrCreateWallet(std::move(wallet)); } + + m_activity_thread.start(); } // Not using the default destructor because not all member types definitions are // available in the header, just forward declared. -WalletController::~WalletController() {} +WalletController::~WalletController() +{ + m_activity_thread.quit(); + m_activity_thread.wait(); +} std::vector WalletController::getWallets() const { diff --git a/src/qt/walletcontroller.h b/src/qt/walletcontroller.h index 523e47d27a..1664fa6f3f 100644 --- a/src/qt/walletcontroller.h +++ b/src/qt/walletcontroller.h @@ -13,6 +13,7 @@ #include #include +#include class OptionsModel; class PlatformStyle; @@ -51,6 +52,7 @@ Q_SIGNALS: void coinsSent(WalletModel* wallet_model, SendCoinsRecipient recipient, QByteArray transaction); private: + QThread m_activity_thread; interfaces::Node& m_node; const PlatformStyle* const m_platform_style; OptionsModel* const m_options_model; -- cgit v1.2.3