mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-04 07:09:03 +00:00
QtUtils/RunOnObject: Make safe under object destruction
Co-Authored-By: cancel <cancel@cancel.fm>
This commit is contained in:
parent
f31f1a08fb
commit
268b424843
5 changed files with 61 additions and 13 deletions
|
@ -30,7 +30,7 @@ void Updater::OnUpdateAvailable(const NewVersionInformation& info)
|
|||
{
|
||||
bool later = false;
|
||||
|
||||
int choice = RunOnObject(m_parent, [&] {
|
||||
std::optional<int> choice = RunOnObject(m_parent, [&] {
|
||||
QDialog* dialog = new QDialog(m_parent);
|
||||
dialog->setWindowTitle(tr("Update available"));
|
||||
dialog->setWindowFlags(dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
@ -79,7 +79,7 @@ void Updater::OnUpdateAvailable(const NewVersionInformation& info)
|
|||
return dialog->exec();
|
||||
});
|
||||
|
||||
if (choice == QDialog::Accepted)
|
||||
if (choice && *choice == QDialog::Accepted)
|
||||
{
|
||||
TriggerUpdate(info, later ? AutoUpdateChecker::RestartMode::NO_RESTART_AFTER_UPDATE :
|
||||
AutoUpdateChecker::RestartMode::RESTART_AFTER_UPDATE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue