Skip to content

Commit be82dea

Browse files
committed
gui: Add thread to run background activity in WalletController
1 parent 6c49a55 commit be82dea

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/qt/walletcontroller.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,17 @@ WalletController::WalletController(interfaces::Node& node, const PlatformStyle*
2626
for (std::unique_ptr<interfaces::Wallet>& wallet : m_node.getWallets()) {
2727
getOrCreateWallet(std::move(wallet));
2828
}
29+
30+
m_activity_thread.start();
2931
}
3032

3133
// Not using the default destructor because not all member types definitions are
3234
// available in the header, just forward declared.
33-
WalletController::~WalletController() {}
35+
WalletController::~WalletController()
36+
{
37+
m_activity_thread.quit();
38+
m_activity_thread.wait();
39+
}
3440

3541
std::vector<WalletModel*> WalletController::getWallets() const
3642
{

src/qt/walletcontroller.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <vector>
1414

1515
#include <QMutex>
16+
#include <QThread>
1617

1718
class OptionsModel;
1819
class PlatformStyle;
@@ -51,6 +52,7 @@ private Q_SLOTS:
5152
void coinsSent(WalletModel* wallet_model, SendCoinsRecipient recipient, QByteArray transaction);
5253

5354
private:
55+
QThread m_activity_thread;
5456
interfaces::Node& m_node;
5557
const PlatformStyle* const m_platform_style;
5658
OptionsModel* const m_options_model;

0 commit comments

Comments
 (0)