mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Replaced CPlayerInterface::pim with CGuiHandler::interfaceLock
- Removed CPlayerInterface::pim since this lock does not actually protects LOCPLINT but rather entire game UI state - added more logical CGuiHandler::interfaceLock - interface lock is now non-recursive and is locked only once by initial caller that want to access GUI
This commit is contained in:
@@ -74,7 +74,8 @@ void ClientCommandManager::handleGoSoloCommand()
|
||||
{
|
||||
Settings session = settings.write["session"];
|
||||
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
||||
|
||||
if(!CSH->client)
|
||||
{
|
||||
printCommandMessage("Game is not in playing state");
|
||||
@@ -120,7 +121,8 @@ void ClientCommandManager::handleControlaiCommand(std::istringstream& singleWord
|
||||
singleWordBuffer >> colorName;
|
||||
boost::to_lower(colorName);
|
||||
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
||||
|
||||
if(!CSH->client)
|
||||
{
|
||||
printCommandMessage("Game is not in playing state");
|
||||
@@ -416,14 +418,6 @@ void ClientCommandManager::handleSetCommand(std::istringstream& singleWordBuffer
|
||||
}
|
||||
}
|
||||
|
||||
void ClientCommandManager::handleUnlockCommand(std::istringstream& singleWordBuffer)
|
||||
{
|
||||
std::string mxname;
|
||||
singleWordBuffer >> mxname;
|
||||
if(mxname == "pim" && LOCPLINT)
|
||||
LOCPLINT->pim->unlock();
|
||||
}
|
||||
|
||||
void ClientCommandManager::handleCrashCommand()
|
||||
{
|
||||
int* ptr = nullptr;
|
||||
@@ -460,7 +454,7 @@ void ClientCommandManager::printCommandMessage(const std::string &commandMessage
|
||||
|
||||
if(currentCallFromIngameConsole)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
||||
if(LOCPLINT && LOCPLINT->cingconsole)
|
||||
{
|
||||
LOCPLINT->cingconsole->print(commandMessage);
|
||||
@@ -547,9 +541,6 @@ void ClientCommandManager::processCommand(const std::string & message, bool call
|
||||
else if (commandName == "set")
|
||||
handleSetCommand(singleWordBuffer);
|
||||
|
||||
else if(commandName == "unlock")
|
||||
handleUnlockCommand(singleWordBuffer);
|
||||
|
||||
else if(commandName == "crash")
|
||||
handleCrashCommand();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user