1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-08-13 17:59:53 +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() 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, // HACK: Because AquariaMenuItem assigns onClick() in it's ctor,
// but we handle this ourselves. // but we handle this ourselves.
@ -426,7 +426,7 @@ void BasicIcon::onUpdate(float dt)
AquariaMenuItem::onUpdate(dt); AquariaMenuItem::onUpdate(dt);
// Autoscroll if selecting icon outside of screen // Autoscroll if selecting icon outside of screen
if(hasFocus() && dsq->modSelectorScr) if(hasFocus() && dsq->modSelectorScr && !_isRecCall)
{ {
Vector pos = getRealPosition(); Vector pos = getRealPosition();
if(pos.y < 20 || pos.y > 580) if(pos.y < 20 || pos.y > 580)
@ -435,7 +435,9 @@ void BasicIcon::onUpdate(float dt)
dsq->modSelectorScr->move(5, true); dsq->modSelectorScr->move(5, true);
else else
dsq->modSelectorScr->move(-5, true); 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 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 setFocus(true); // re-position mouse
} }
} }

View file

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