QtUtils/RunOnObject: Make safe under object destruction

Co-Authored-By: cancel <cancel@cancel.fm>
This commit is contained in:
riking 2018-05-21 15:27:12 -07:00
parent f31f1a08fb
commit 268b424843
5 changed files with 61 additions and 13 deletions

View file

@ -1196,13 +1196,16 @@ void MainWindow::OnImportNANDBackup()
});
},
[this] {
return RunOnObject(this, [this] {
std::optional<std::string> keys_file = RunOnObject(this, [this] {
return QFileDialog::getOpenFileName(this, tr("Select the keys file (OTP/SEEPROM dump)"),
QDir::currentPath(),
tr("BootMii keys file (*.bin);;"
"All Files (*)"))
.toStdString();
});
if (keys_file)
return *keys_file;
return std::string("");
});
QueueOnObject(dialog, &QProgressDialog::close);
});