You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Handle missing min/max gracefully for sliders/scrollbars #32
I did some digging. The reason it freezes is not because min and max are null—that would throw an NPE after all. It's because min defaults to Integer.MIN_VALUE and max to Integer.MAX_VALUE. The UI builder then proceeds to try to make a slider or scroll bar with a massively huge range, and the CPU goes to 100% indefinitely. The problem is this and that lines of code in the DefaultWidgetModel.
A possible fix would be to change the code that creates the JScrollBar or JSlider to be more conservative about what it feeds to those constructors. This would also guard against the case of explicit min="-1000000000", max="1000000000" sorts of inputs.
Thanks for digging, @ctrueden!
I think we can tackle this at the same time as allowing non-integer step sizes in sliders (see #31), by adjusting the step size in case the number of possible steps gets unreasonably high (the acceptable limit might have to be found by testing with different settings).
Activity
ctrueden commentedon Nov 3, 2017
I did some digging. The reason it freezes is not because min and max are null—that would throw an NPE after all. It's because min defaults to
Integer.MIN_VALUEand max toInteger.MAX_VALUE. The UI builder then proceeds to try to make a slider or scroll bar with a massively huge range, and the CPU goes to 100% indefinitely. The problem is this and that lines of code in theDefaultWidgetModel.A possible fix would be to change the code that creates the
JScrollBarorJSliderto be more conservative about what it feeds to those constructors. This would also guard against the case of explicitmin="-1000000000", max="1000000000"sorts of inputs.imagejan commentedon Nov 3, 2017
Thanks for digging, @ctrueden!
I think we can tackle this at the same time as allowing non-integer step sizes in sliders (see #31), by adjusting the step size in case the number of possible steps gets unreasonably high (the acceptable limit might have to be found by testing with different settings).
ctrueden commentedon Nov 3, 2017
I believe I have fixed the integer cases. Handling non-integers will be more involved, though.