1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Added workaround for potential access to CIntObject after destruction

This commit is contained in:
Ivan Savenko 2024-04-11 13:23:05 +03:00
parent c99d4b959e
commit cbd5f57069

View File

@ -213,12 +213,21 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc
if( i->receiveEvent(position, AEventsReceiver::LCLICK) || i == nearestElement)
{
if(isPressed)
{
i->mouseClickedState = isPressed;
i->clickPressed(position, lastActivated);
}
else
{
if (i->mouseClickedState)
{
i->mouseClickedState = isPressed;
i->clickReleased(position, lastActivated);
}
else
i->mouseClickedState = isPressed;
}
if (i->mouseClickedState && !isPressed)
i->clickReleased(position, lastActivated);
i->mouseClickedState = isPressed;
lastActivated = false;
}
else