connect(m_ctx->nodes, &Nodes::WSNodeExhausted, this, &MainWindow::showWSNodeExhaustedMessage);
// Wallet
- connect(m_ctx->wallet.get(), &Wallet::connectionStatusChanged, this, &MainWindow::onConnectionStatusChanged);
- connect(m_ctx->wallet.get(), &Wallet::currentSubaddressAccountChanged, this, &MainWindow::updateTitle);
+ connect(m_ctx->wallet, &Wallet::connectionStatusChanged, this, &MainWindow::onConnectionStatusChanged);
+ connect(m_ctx->wallet, &Wallet::currentSubaddressAccountChanged, this, &MainWindow::updateTitle);
}
void MainWindow::menuToggleTabVisible(const QString &key){
}
void MainWindow::showPasswordDialog() {
- PasswordChangeDialog dialog{this, m_ctx->wallet.get()};
+ PasswordChangeDialog dialog{this, m_ctx->wallet};
dialog.exec();
this->updatePasswordIcon();
}
}
void MainWindow::menuSignVerifyClicked() {
- SignVerifyDialog dialog{m_ctx->wallet.get(), this};
+ SignVerifyDialog dialog{m_ctx->wallet, this};
dialog.exec();
}
void MainWindow::menuVerifyTxProof() {
- VerifyProofDialog dialog{m_ctx->wallet.get(), this};
+ VerifyProofDialog dialog{m_ctx->wallet, this};
dialog.exec();
}
m_txTimer.stop();
this->saveGeo();
+ m_ctx->stopTimers();
m_windowManager->closeWindow(this);
}
}
void MainWindow::showBalanceDialog() {
- BalanceDialog dialog{this, m_ctx->wallet.get()};
+ BalanceDialog dialog{this, m_ctx->wallet};
dialog.exec();
}
WindowManager::WindowManager() {
m_walletManager = WalletManager::instance();
m_splashDialog = new SplashDialog;
+ m_cleanupThread = new QThread();
connect(m_walletManager, &WalletManager::walletOpened, this, &WindowManager::onWalletOpened);
connect(m_walletManager, &WalletManager::walletCreated, this, &WindowManager::onWalletCreated);
void WindowManager::closeWindow(MainWindow *window) {
m_windows.removeOne(window);
+
+ // Move Wallet to a different thread for cleanup so it doesn't block GUI thread
+ window->m_ctx->wallet->moveToThread(m_cleanupThread);
+ m_cleanupThread->start();
+ window->m_ctx->wallet->deleteLater();
}
void WindowManager::restartApplication(const QString &binaryFilename) {
, networkType(constants::networkType)
, m_rpc(new DaemonRpc{this, getNetworkTor(), ""})
{
- connect(this->wallet.get(), &Wallet::moneySpent, this, &AppContext::onMoneySpent);
- connect(this->wallet.get(), &Wallet::moneyReceived, this, &AppContext::onMoneyReceived);
- connect(this->wallet.get(), &Wallet::unconfirmedMoneyReceived, this, &AppContext::onUnconfirmedMoneyReceived);
- connect(this->wallet.get(), &Wallet::newBlock, this, &AppContext::onWalletNewBlock);
- connect(this->wallet.get(), &Wallet::updated, this, &AppContext::onWalletUpdate);
- connect(this->wallet.get(), &Wallet::refreshed, this, &AppContext::onWalletRefreshed);
- connect(this->wallet.get(), &Wallet::transactionCommitted, this, &AppContext::onTransactionCommitted);
- connect(this->wallet.get(), &Wallet::heightRefreshed, this, &AppContext::onHeightRefreshed);
- connect(this->wallet.get(), &Wallet::transactionCreated, this, &AppContext::onTransactionCreated);
- connect(this->wallet.get(), &Wallet::deviceError, this, &AppContext::onDeviceError);
- connect(this->wallet.get(), &Wallet::deviceButtonRequest, this, &AppContext::onDeviceButtonRequest);
- connect(this->wallet.get(), &Wallet::deviceButtonPressed, this, &AppContext::onDeviceButtonPressed);
- connect(this->wallet.get(), &Wallet::connectionStatusChanged, [this]{
+ connect(this->wallet, &Wallet::moneySpent, this, &AppContext::onMoneySpent);
+ connect(this->wallet, &Wallet::moneyReceived, this, &AppContext::onMoneyReceived);
+ connect(this->wallet, &Wallet::unconfirmedMoneyReceived, this, &AppContext::onUnconfirmedMoneyReceived);
+ connect(this->wallet, &Wallet::newBlock, this, &AppContext::onWalletNewBlock);
+ connect(this->wallet, &Wallet::updated, this, &AppContext::onWalletUpdate);
+ connect(this->wallet, &Wallet::refreshed, this, &AppContext::onWalletRefreshed);
+ connect(this->wallet, &Wallet::transactionCommitted, this, &AppContext::onTransactionCommitted);
+ connect(this->wallet, &Wallet::heightRefreshed, this, &AppContext::onHeightRefreshed);
+ connect(this->wallet, &Wallet::transactionCreated, this, &AppContext::onTransactionCreated);
+ connect(this->wallet, &Wallet::deviceError, this, &AppContext::onDeviceError);
+ connect(this->wallet, &Wallet::deviceButtonRequest, this, &AppContext::onDeviceButtonRequest);
+ connect(this->wallet, &Wallet::deviceButtonPressed, this, &AppContext::onDeviceButtonPressed);
+ connect(this->wallet, &Wallet::connectionStatusChanged, [this]{
this->nodes->autoConnect();
});
- connect(this->wallet.get(), &Wallet::currentSubaddressAccountChanged, [this]{
+ connect(this->wallet, &Wallet::currentSubaddressAccountChanged, [this]{
this->updateBalance();
});
emit openAliasResolveError(msg);
}
+void AppContext::stopTimers() {
+ m_storeTimer.stop();
+}
+
// ########################################## LIBWALLET QT SIGNALS ####################################################
void AppContext::onMoneySpent(const QString &txId, quint64 amount) {