1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 09:44:02 +00:00

Fix possible stack overflow

Why did this never happen before??!
This commit is contained in:
fgenesis 2016-11-14 04:17:53 +01:00
parent 9422e74e43
commit b32ce853e7
2 changed files with 5 additions and 2 deletions

View file

@ -399,7 +399,7 @@ void JuicyProgressBar::progress(float p)
}
BasicIcon::BasicIcon()
: mouseDown(false), scaleNormal(1,1), scaleBig(scaleNormal * 1.1f)
: mouseDown(false), scaleNormal(1,1), scaleBig(scaleNormal * 1.1f), _isRecCall(false)
{
// HACK: Because AquariaMenuItem assigns onClick() in it's ctor,
// but we handle this ourselves.
@ -426,7 +426,7 @@ void BasicIcon::onUpdate(float dt)
AquariaMenuItem::onUpdate(dt);
// Autoscroll if selecting icon outside of screen
if(hasFocus() && dsq->modSelectorScr)
if(hasFocus() && dsq->modSelectorScr && !_isRecCall)
{
Vector pos = getRealPosition();
if(pos.y < 20 || pos.y > 580)
@ -435,7 +435,9 @@ void BasicIcon::onUpdate(float dt)
dsq->modSelectorScr->move(5, true);
else
dsq->modSelectorScr->move(-5, true);
_isRecCall = true;
core->run(FRAME_TIME); // HACK: this is necessary to correctly position the mouse on the object after moving the panel
_isRecCall = false;
setFocus(true); // re-position mouse
}
}

View file

@ -39,6 +39,7 @@ protected:
bool mouseDown;
Vector scaleNormal;
Vector scaleBig;
bool _isRecCall;
virtual void onUpdate(float dt);
virtual void onClick();
};