mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-05 00:49:09 +02:00
Fix another case of assertion failure on exit
This commit is contained in:
@ -1508,9 +1508,7 @@ static void mainLoop()
|
||||
}
|
||||
}
|
||||
|
||||
void handleQuit(bool ask)
|
||||
{
|
||||
auto quitApplication = []()
|
||||
static void quitApplication()
|
||||
{
|
||||
if(!settings["session"]["headless"].Bool())
|
||||
{
|
||||
@ -1574,22 +1572,25 @@ void handleQuit(bool ask)
|
||||
logConfig = nullptr;
|
||||
}
|
||||
|
||||
|
||||
std::cout << "Ending...\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void handleQuit(bool ask)
|
||||
{
|
||||
|
||||
if(CSH->client && LOCPLINT && ask)
|
||||
{
|
||||
CCS->curh->changeGraphic(ECursor::ADVENTURE, 0);
|
||||
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[69], [](){
|
||||
// Workaround for assertion failure on exit:
|
||||
// handleQuit() is alway called during SDL event processing
|
||||
// during which, eventsM is kept locked
|
||||
// this leads to assertion failure if boost::mutex is in locked state
|
||||
eventsM.unlock();
|
||||
|
||||
exit(0);
|
||||
};
|
||||
|
||||
if(CSH->client && LOCPLINT && ask)
|
||||
{
|
||||
CCS->curh->changeGraphic(ECursor::ADVENTURE, 0);
|
||||
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[69], quitApplication, nullptr);
|
||||
quitApplication();
|
||||
}, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user