When opening/closing the console repeatedly, it sometimes crashes. (See attached backtrace)
The issue happens in drawInteriorRoundedSquareAlg(). When it gets a small enough h, it goes through the the h>0 test.
h is then modified a few lines later:
h -= 2*Base::_strokeWidth;
Here it turns to 0 and causes the crash.
This can be easily guarded with another if(h<=0){return;}
at that point.
However, I think there's another bug behind this:
strokeWidth is usually 0 when the console slides, so h shouldn't change by the above snipept.
In my crash (and tests where I slowed down the slide and printed the values), _strokeWidth was always 1. I'm not sure what caused it to change to 1.
Diff:
I think it might be best to change the early check to assure w and h are bigger than the values subtracted at a later point. Or simply move the check further down below (if that doesn't cause other issues).
The problem is with the scroll bar in the console, which uses a stroke >= 0.
To consistently get the error, type several "help" commands to get a scrollbar, before closing the console. You have to slow down the console sliding so it will always try to render the last few frames at the top of the screen:
So, do you think a good solution to move the
if (w <= 0 || h <= 0) { return; }
?I don't like the idea of performing the calculation inside the test itself - IMO it should be kept simple.
Fixed in 9b69b86f2972c93395ce6ee88f5566a31a05ce0d