mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix assertion failure on exit due to mutex lock
This commit is contained in:
parent
e23166df88
commit
f827571f9b
@ -70,13 +70,22 @@ void InputHandler::handleCurrentEvent(const SDL_Event & current)
|
||||
}
|
||||
}
|
||||
|
||||
void InputHandler::processEvents()
|
||||
std::vector<SDL_Event> InputHandler::acquireEvents()
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lock(eventsMutex);
|
||||
for(const auto & currentEvent : eventsQueue)
|
||||
|
||||
std::vector<SDL_Event> result;
|
||||
std::swap(result, eventsQueue);
|
||||
return result;
|
||||
}
|
||||
|
||||
void InputHandler::processEvents()
|
||||
{
|
||||
std::vector<SDL_Event> eventsToProcess = acquireEvents();
|
||||
|
||||
for(const auto & currentEvent : eventsToProcess)
|
||||
handleCurrentEvent(currentEvent);
|
||||
|
||||
eventsQueue.clear();
|
||||
fingerHandler->handleUpdate();
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@ class InputHandler
|
||||
|
||||
Point cursorPosition;
|
||||
|
||||
std::vector<SDL_Event> acquireEvents();
|
||||
|
||||
void preprocessEvent(const SDL_Event & event);
|
||||
void handleCurrentEvent(const SDL_Event & current);
|
||||
void handleUserEvent(const SDL_UserEvent & current);
|
||||
|
Loading…
Reference in New Issue
Block a user