1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Use exception throwing to shutdown main thread

This commit is contained in:
Ivan Savenko
2025-03-04 15:25:04 +00:00
parent 9732d39c70
commit a474803aaf
4 changed files with 30 additions and 15 deletions

View File

@@ -100,13 +100,15 @@ bool GameInstance::capturedAllEvents()
void GameInstance::onShutdownRequested(bool ask)
{
auto doQuit = [](){ throw GameShutdownException(); };
if(!ask)
quitApplication();
doQuit();
else
{
if (interface())
interface()->showYesNoDialog(LIBRARY->generaltexth->allTexts[69], quitApplication, nullptr);
interface()->showYesNoDialog(LIBRARY->generaltexth->allTexts[69], doQuit, nullptr);
else
CInfoWindow::showYesNoDialog(LIBRARY->generaltexth->allTexts[69], {}, quitApplication, {}, PlayerColor(1));
CInfoWindow::showYesNoDialog(LIBRARY->generaltexth->allTexts[69], {}, doQuit, {}, PlayerColor(1));
}
}