mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Attempt to trace crash caused by iterator invalidation
This commit is contained in:
parent
d34268d7d5
commit
5fb5513572
@ -98,9 +98,12 @@ void CGuiHandler::init()
|
|||||||
pointerSpeedMultiplier = settings["general"]["relativePointerSpeedMultiplier"].Float();
|
pointerSpeedMultiplier = settings["general"]["relativePointerSpeedMultiplier"].Float();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool debugDetectDeactivationDuringHandle = false;
|
||||||
|
|
||||||
void CGuiHandler::handleElementActivate(CIntObject * elem, ui16 activityFlag)
|
void CGuiHandler::handleElementActivate(CIntObject * elem, ui16 activityFlag)
|
||||||
{
|
{
|
||||||
processLists(activityFlag,[&](std::list<CIntObject*> * lst){
|
processLists(activityFlag,[&](std::list<CIntObject*> * lst){
|
||||||
|
assert(debugDetectDeactivationDuringHandle == false);
|
||||||
lst->push_front(elem);
|
lst->push_front(elem);
|
||||||
});
|
});
|
||||||
elem->active_m |= activityFlag;
|
elem->active_m |= activityFlag;
|
||||||
@ -109,6 +112,7 @@ void CGuiHandler::handleElementActivate(CIntObject * elem, ui16 activityFlag)
|
|||||||
void CGuiHandler::handleElementDeActivate(CIntObject * elem, ui16 activityFlag)
|
void CGuiHandler::handleElementDeActivate(CIntObject * elem, ui16 activityFlag)
|
||||||
{
|
{
|
||||||
processLists(activityFlag,[&](std::list<CIntObject*> * lst){
|
processLists(activityFlag,[&](std::list<CIntObject*> * lst){
|
||||||
|
assert(debugDetectDeactivationDuringHandle == false);
|
||||||
auto hlp = std::find(lst->begin(),lst->end(),elem);
|
auto hlp = std::find(lst->begin(),lst->end(),elem);
|
||||||
assert(hlp != lst->end());
|
assert(hlp != lst->end());
|
||||||
lst->erase(hlp);
|
lst->erase(hlp);
|
||||||
@ -594,6 +598,7 @@ void CGuiHandler::handleMouseMotion(const SDL_Event & current)
|
|||||||
//sending active, hovered hoverable objects hover() call
|
//sending active, hovered hoverable objects hover() call
|
||||||
std::vector<CIntObject*> hlp;
|
std::vector<CIntObject*> hlp;
|
||||||
|
|
||||||
|
debugDetectDeactivationDuringHandle = true;
|
||||||
auto hoverableCopy = hoverable;
|
auto hoverableCopy = hoverable;
|
||||||
for(auto & elem : hoverableCopy)
|
for(auto & elem : hoverableCopy)
|
||||||
{
|
{
|
||||||
@ -608,6 +613,7 @@ void CGuiHandler::handleMouseMotion(const SDL_Event & current)
|
|||||||
(elem)->hovered = false;
|
(elem)->hovered = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
debugDetectDeactivationDuringHandle = false;
|
||||||
assert(hoverableCopy == hoverable);
|
assert(hoverableCopy == hoverable);
|
||||||
|
|
||||||
for(auto & elem : hlp)
|
for(auto & elem : hlp)
|
||||||
|
Loading…
Reference in New Issue
Block a user