mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
Fixed several assertion failures on shutting down game
This commit is contained in:
@@ -585,6 +585,7 @@ void removeGUI()
|
||||
GH.curInt = nullptr;
|
||||
if(GH.topInt())
|
||||
GH.topInt()->deactivate();
|
||||
adventureInt = nullptr;
|
||||
GH.listInt.clear();
|
||||
GH.objsToBlit.clear();
|
||||
GH.statusbar = nullptr;
|
||||
@@ -1573,7 +1574,15 @@ void handleQuit(bool ask)
|
||||
logConfig = nullptr;
|
||||
}
|
||||
|
||||
|
||||
std::cout << "Ending...\n";
|
||||
|
||||
// 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);
|
||||
};
|
||||
|
||||
|
||||
+1
-9
@@ -380,20 +380,12 @@ void CClient::endGame()
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
logNetwork->info("Ending current game!");
|
||||
if(GH.topInt())
|
||||
{
|
||||
GH.topInt()->deactivate();
|
||||
}
|
||||
GH.listInt.clear();
|
||||
GH.objsToBlit.clear();
|
||||
GH.statusbar = nullptr;
|
||||
logNetwork->info("Removed GUI.");
|
||||
removeGUI();
|
||||
|
||||
vstd::clear_pointer(const_cast<CGameInfo *>(CGI)->mh);
|
||||
vstd::clear_pointer(gs);
|
||||
|
||||
logNetwork->info("Deleted mapHandler and gameState.");
|
||||
LOCPLINT = nullptr;
|
||||
}
|
||||
|
||||
playerint.clear();
|
||||
|
||||
@@ -205,7 +205,9 @@ BattleInterface::~BattleInterface()
|
||||
CCS->musich->playMusicFromSet("terrain", terrain.name, true, false);
|
||||
}
|
||||
|
||||
assert(getAnimationCondition(EAnimationEvents::ACTION) == false);
|
||||
// may happen if user decided to close game while in battle
|
||||
if (getAnimationCondition(EAnimationEvents::ACTION) == true)
|
||||
logGlobal->error("Shutting down BattleInterface during animation playback!");
|
||||
setAnimationCondition(EAnimationEvents::ACTION, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user