mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 15:20:05 +00:00
Catch exceptions in background threads
This commit is contained in:
parent
863cdd0384
commit
e1d61fccfa
13 changed files with 866 additions and 665 deletions
|
|
@ -612,20 +612,27 @@ void MainWindow::on_actionCheckForUpdates_triggered()
|
|||
p->threadPool_,
|
||||
[this]()
|
||||
{
|
||||
if (!p->updateManager_->CheckForUpdates(main::kVersionString_))
|
||||
try
|
||||
{
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]()
|
||||
{
|
||||
QMessageBox* messageBox = new QMessageBox(this);
|
||||
messageBox->setIcon(QMessageBox::Icon::Information);
|
||||
messageBox->setWindowTitle(tr("Check for Updates"));
|
||||
messageBox->setText(tr("Supercell Wx is up to date."));
|
||||
messageBox->setStandardButtons(
|
||||
QMessageBox::StandardButton::Ok);
|
||||
messageBox->show();
|
||||
});
|
||||
if (!p->updateManager_->CheckForUpdates(main::kVersionString_))
|
||||
{
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]()
|
||||
{
|
||||
QMessageBox* messageBox = new QMessageBox(this);
|
||||
messageBox->setIcon(QMessageBox::Icon::Information);
|
||||
messageBox->setWindowTitle(tr("Check for Updates"));
|
||||
messageBox->setText(tr("Supercell Wx is up to date."));
|
||||
messageBox->setStandardButtons(
|
||||
QMessageBox::StandardButton::Ok);
|
||||
messageBox->show();
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
logger_->error(ex.what());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -663,9 +670,16 @@ void MainWindowImpl::AsyncSetup()
|
|||
boost::asio::post(threadPool_,
|
||||
[this]()
|
||||
{
|
||||
manager::UpdateManager::RemoveTemporaryReleases();
|
||||
updateManager_->CheckForUpdates(
|
||||
main::kVersionString_);
|
||||
try
|
||||
{
|
||||
manager::UpdateManager::RemoveTemporaryReleases();
|
||||
updateManager_->CheckForUpdates(
|
||||
main::kVersionString_);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
logger_->error(ex.what());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue