mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
CGuiHandler: make terminate_cond non-static
Static variable might be not yet initialized by the time it's used inside CGuiHandler constructor. This fix let us avoid crash that occur when built with Xcode 8.2.1
This commit is contained in:
parent
5067e73c30
commit
cd98dd0b89
0
CMakeLists.txt.autosave.t10925
Normal file
0
CMakeLists.txt.autosave.t10925
Normal file
0
CMakeLists.txt.s10925
Normal file
0
CMakeLists.txt.s10925
Normal file
@ -125,7 +125,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player)
|
||||
makingTurn = false;
|
||||
showingDialog = new CondSh<bool>(false);
|
||||
cingconsole = new CInGameConsole();
|
||||
GH.terminate_cond.set(false);
|
||||
GH.terminate_cond->set(false);
|
||||
firstCall = 1; //if loading will be overwritten in serialize
|
||||
autosaveCount = 0;
|
||||
isAutoFightOn = false;
|
||||
@ -2196,7 +2196,7 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
|
||||
{
|
||||
if (adventureInt)
|
||||
{
|
||||
GH.terminate_cond.setn(true);
|
||||
GH.terminate_cond->setn(true);
|
||||
adventureInt->deactivate();
|
||||
if (GH.topInt() == adventureInt)
|
||||
GH.popInt(adventureInt);
|
||||
|
@ -546,7 +546,7 @@ CGPreGame *CGPreGame::create()
|
||||
if(!CGP)
|
||||
CGP = new CGPreGame();
|
||||
|
||||
GH.terminate_cond.set(false);
|
||||
GH.terminate_cond->set(false);
|
||||
return CGP;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
extern std::queue<SDL_Event> events;
|
||||
extern boost::mutex eventsM;
|
||||
|
||||
CondSh<bool> CGuiHandler::terminate_cond(false);
|
||||
boost::thread_specific_ptr<bool> inGuiThread;
|
||||
|
||||
SObjectConstruction::SObjectConstruction(CIntObject *obj)
|
||||
@ -443,7 +442,7 @@ void CGuiHandler::renderFrame()
|
||||
//in PreGame terminate_cond stay false
|
||||
|
||||
bool acquiredTheLockOnPim = false; //for tracking whether pim mutex locking succeeded
|
||||
while(!terminate_cond.get() && !(acquiredTheLockOnPim = CPlayerInterface::pim->try_lock())) //try acquiring long until it succeeds or we are told to terminate
|
||||
while(!terminate_cond->get() && !(acquiredTheLockOnPim = CPlayerInterface::pim->try_lock())) //try acquiring long until it succeeds or we are told to terminate
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(15));
|
||||
|
||||
if(acquiredTheLockOnPim)
|
||||
@ -481,7 +480,7 @@ CGuiHandler::CGuiHandler()
|
||||
mainFPSmng = new CFramerateManager(48);
|
||||
//do not init CFramerateManager here --AVS
|
||||
|
||||
terminate_cond.set(false);
|
||||
terminate_cond = new CondSh<bool>(false);
|
||||
}
|
||||
|
||||
CGuiHandler::~CGuiHandler()
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
static bool amIGuiThread();
|
||||
static void pushSDLEvent(int type, int usercode = 0);
|
||||
|
||||
static CondSh<bool> terminate_cond; // confirm termination
|
||||
CondSh<bool> * terminate_cond; // confirm termination
|
||||
};
|
||||
|
||||
extern CGuiHandler GH; //global gui handler
|
||||
|
Loading…
Reference in New Issue
Block a user