[BR] juce::Grid hangs performing layout

When performing the layout juce::Grid hangs if the height doesn’t allow to put the rows.

Sadly in video below i can’t show the spinning pinwheel. :confused:

In my app i need to arrange variable number of components (with different span/size) in a grid.

Are your sure your number of rows is always at least 1? Looks like you’re dynamically calculating the number of rows and columns so you probably want to ensure both are always at least 1.

1 Like

This will come out as 0 if the height is less than gap + size.

1 Like

Thanks, i’ll check that.
But i would expected juce::Grid to handle that edge case properly instead of hanging.
At least an assertion.

In CSS if you don’t specify a grid-template-columns or grid-template-rows they’ll each default to auto. So juce::Grid::templateColumns and juce::Grid::templateRows should really be defaulted to { TrackInfo{} };.

Since it’s not valid to have 0 columns or 0 rows, performLayout should probably have an assertion if the size of either is 0 - or just silently handle it and default them back to an auto track info.

I get exactly the same problem with rows & columns forced to be at least one.

Note that my components in that example use a span of 2.

It seems that it bugs with 1 default row and components with span of 2 (or more).
Is auto rows/columns supposed to work in that case?

Thanks for reporting, a fix has been added to develop:

2 Likes