gui: Delete progress dialog instead of hidding it

pull/764/head
João Barbosa 5 years ago
parent ee9e88ba27
commit 9eefc6e92f

@ -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));

@ -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;

Loading…
Cancel
Save