Skip to content

Commit 9eefc6e

Browse files
committed
gui: Delete progress dialog instead of hidding it
1 parent ee9e88b commit 9eefc6e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/qt/walletcontroller.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ WalletControllerActivity::~WalletControllerActivity()
166166

167167
void WalletControllerActivity::showProgressDialog(const QString& label_text)
168168
{
169+
assert(!m_progress_dialog);
169170
m_progress_dialog = new QProgressDialog(m_parent_widget);
170171

171172
m_progress_dialog->setLabelText(label_text);
@@ -175,6 +176,13 @@ void WalletControllerActivity::showProgressDialog(const QString& label_text)
175176
GUIUtil::PolishProgressDialog(m_progress_dialog);
176177
}
177178

179+
void WalletControllerActivity::destroyProgressDialog()
180+
{
181+
assert(m_progress_dialog);
182+
delete m_progress_dialog;
183+
m_progress_dialog = nullptr;
184+
}
185+
178186
CreateWalletActivity::CreateWalletActivity(WalletController* wallet_controller, QWidget* parent_widget)
179187
: WalletControllerActivity(wallet_controller, parent_widget)
180188
{
@@ -229,7 +237,7 @@ void CreateWalletActivity::createWallet()
229237

230238
void CreateWalletActivity::finish()
231239
{
232-
m_progress_dialog->hide();
240+
destroyProgressDialog();
233241

234242
if (!m_error_message.empty()) {
235243
QMessageBox::critical(m_parent_widget, tr("Create wallet failed"), QString::fromStdString(m_error_message));
@@ -270,7 +278,7 @@ OpenWalletActivity::OpenWalletActivity(WalletController* wallet_controller, QWid
270278

271279
void OpenWalletActivity::finish()
272280
{
273-
m_progress_dialog->hide();
281+
destroyProgressDialog();
274282

275283
if (!m_error_message.empty()) {
276284
QMessageBox::critical(m_parent_widget, tr("Open wallet failed"), QString::fromStdString(m_error_message));

src/qt/walletcontroller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class WalletControllerActivity : public QObject
9696
QObject* worker() const { return m_wallet_controller->m_activity_worker; }
9797

9898
void showProgressDialog(const QString& label_text);
99+
void destroyProgressDialog();
99100

100101
WalletController* const m_wallet_controller;
101102
QWidget* const m_parent_widget;

0 commit comments

Comments
 (0)