aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-03-30 11:41:20 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-03-31 14:23:43 +0100
commit9eefc6e92fa1acef6eddd87886ed80510b439a57 (patch)
treecd03e4b90d00cd6d42a42020f399a69883fc6e40 /src
parentee9e88ba2734b81d0ffe23fd45c4f69a970c6494 (diff)
gui: Delete progress dialog instead of hidding it
Diffstat (limited to 'src')
-rw-r--r--src/qt/walletcontroller.cpp12
-rw-r--r--src/qt/walletcontroller.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp
index 88c694567e..f076b5ba61 100644
--- a/src/qt/walletcontroller.cpp
+++ b/src/qt/walletcontroller.cpp
@@ -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));
diff --git a/src/qt/walletcontroller.h b/src/qt/walletcontroller.h
index 956245775e..f30eb25308 100644
--- a/src/qt/walletcontroller.h
+++ b/src/qt/walletcontroller.h
@@ -96,6 +96,7 @@ protected:
QObject* worker() const { return m_wallet_controller->m_activity_worker; }
void showProgressDialog(const QString& label_text);
+ void destroyProgressDialog();
WalletController* const m_wallet_controller;
QWidget* const m_parent_widget;