From c7bda4f87606711b22f8374152c830f84421bfb3 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Thu, 1 Nov 2018 14:44:51 -0700 Subject: [PATCH] Clear turnstile if migration is done while progress box is opened --- src/mainwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d266806..f1ea439 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -95,7 +95,8 @@ void MainWindow::turnstileProgress() { QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning); progress.msgIcon->setPixmap(icon.pixmap(64, 64)); - auto fnUpdateProgressUI = [=] () { + bool migrationFinished = false; + auto fnUpdateProgressUI = [=, &migrationFinished] () mutable { // Get the plan progress if (rpc->getTurnstile()->isMigrationPresent()) { auto curProgress = rpc->getTurnstile()->getPlanProgress(); @@ -109,6 +110,7 @@ void MainWindow::turnstileProgress() { progress.toAddr->setText(curProgress.to); if (curProgress.step == curProgress.totalSteps) { + migrationFinished = true; auto txt = QString("Turnstile migration finished"); if (curProgress.hasErrors) { txt = txt + ". There were some errors.\n\nYour funds are all in your wallet, so you should be able to finish moving them manually."; @@ -155,7 +157,7 @@ void MainWindow::turnstileProgress() { }); d.exec(); - if (curProgress.step == curProgress.totalSteps) { + if (migrationFinished || curProgress.step == curProgress.totalSteps) { // Finished, so delete the file rpc->getTurnstile()->removeFile(); }