diff options
Diffstat (limited to 'src/qt/walletcontroller.cpp')
-rw-r--r-- | src/qt/walletcontroller.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 233c0ab6be..f076b5ba61 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -116,7 +116,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal const bool called = QMetaObject::invokeMethod(wallet_model, "startPollBalance"); assert(called); - connect(wallet_model, &WalletModel::unload, [this, wallet_model] { + connect(wallet_model, &WalletModel::unload, this, [this, wallet_model] { // Defer removeAndDeleteWallet when no modal widget is active. // TODO: remove this workaround by removing usage of QDiallog::exec. if (QApplication::activeModalWidget()) { @@ -128,7 +128,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal } else { removeAndDeleteWallet(wallet_model); } - }); + }, Qt::QueuedConnection); // Re-emit coinsSent signal from wallet model. connect(wallet_model, &WalletModel::coinsSent, this, &WalletController::coinsSent); @@ -166,6 +166,7 @@ WalletControllerActivity::~WalletControllerActivity() void WalletControllerActivity::showProgressDialog(const QString& label_text) { + assert(!m_progress_dialog); m_progress_dialog = new QProgressDialog(m_parent_widget); m_progress_dialog->setLabelText(label_text); @@ -175,6 +176,13 @@ void WalletControllerActivity::showProgressDialog(const QString& label_text) GUIUtil::PolishProgressDialog(m_progress_dialog); } +void WalletControllerActivity::destroyProgressDialog() +{ + assert(m_progress_dialog); + delete m_progress_dialog; + m_progress_dialog = nullptr; +} + CreateWalletActivity::CreateWalletActivity(WalletController* wallet_controller, QWidget* parent_widget) : WalletControllerActivity(wallet_controller, parent_widget) { @@ -229,7 +237,7 @@ void CreateWalletActivity::createWallet() void CreateWalletActivity::finish() { - m_progress_dialog->hide(); + destroyProgressDialog(); if (!m_error_message.empty()) { QMessageBox::critical(m_parent_widget, tr("Create wallet failed"), QString::fromStdString(m_error_message)); @@ -270,7 +278,7 @@ OpenWalletActivity::OpenWalletActivity(WalletController* wallet_controller, QWid void OpenWalletActivity::finish() { - m_progress_dialog->hide(); + destroyProgressDialog(); if (!m_error_message.empty()) { QMessageBox::critical(m_parent_widget, tr("Open wallet failed"), QString::fromStdString(m_error_message)); |