40 lines
750 B
Rust
40 lines
750 B
Rust
use fltk::prelude::*;
|
|
use fltk::group::Flex;
|
|
|
|
fn main () {
|
|
let _wind = fltk::window::Window::default ().with_size (800, 600);
|
|
|
|
let mut col = Flex::default ().column ().size_of_parent ();
|
|
|
|
// If I set `workaround` to true so that the column contains a single
|
|
// non-sized element, then I can add 100 rows with no problem.
|
|
// Otherwise it crashes at 11.
|
|
|
|
let workaround = true;
|
|
if workaround {
|
|
let row = Flex::default ().row ();
|
|
row.end ();
|
|
|
|
col.add (&row);
|
|
}
|
|
|
|
// 11 will trigger the floating-point exception, 10 will not
|
|
|
|
let count = if workaround {
|
|
100
|
|
}
|
|
else {
|
|
11
|
|
};
|
|
|
|
for _ in 0..count {
|
|
let mut row = Flex::default ().row ();
|
|
row.end ();
|
|
|
|
col.add (&row);
|
|
col.set_size (&mut row, 30);
|
|
}
|
|
col.recalc ();
|
|
}
|
|
|