revery icon indicating copy to clipboard operation
revery copied to clipboard

Uncaught Division_by_zero crash on window resize. (maxHeight vs flexGrow ?)

Open geoffder opened this issue 3 years ago • 1 comments

  • Operating System:OS: Manjaro Linux x86_64; Kernel: 5.4.80-2-MANJARO
  • Revery Version: revery#5fe4207 ( via Bonsai_revery )
  • OCaml version: 4.9.0
  • Native, Bytecode, or JS build: Native
Uncaught exception:
  
  Division_by_zero

Raised at file "src/lib/HardCodedEncoding.re" (inlined), line 140, characters 11-14
Called from file "src/lib/Layout.re", line 1135, characters 25-147
Called from file "src/lib/Layout.re", line 291, characters 6-193
Called from file "src/lib/Layout.re", line 604, characters 6-199
Called from file "src/lib/Layout.re", line 1744, characters 12-206
Called from file "src/lib/Layout.re", line 291, characters 6-193
Called from file "src/lib/Layout.re", line 1806, characters 7-214
Called from file "src/UI/Render.re", line 70, characters 2-45
Called from file "src/Core/Window.re", line 395, characters 2-17
Called from file "list.ml", line 110, characters 12-15
Called from file "src/Core/App.re", line 298, characters 6-123
Called from file "packages/reason-sdl2/src/sdl2.re", line 823, characters 10-20
Called from file "packages/reason-sdl2/src/sdl2.re", line 269, characters 17-59
Called from file "packages/reason-sdl2/src/sdl2.re", line 269, characters 17-59
Called from file "src/main.ml", line 6, characters 2-65

I found this (closed on merge) issue https://github.com/revery-ui/revery/issues/180, which sounds pretty similar. I've never had it happen before now, when I set the Style maxHeight on an element that has flexGrow set (= 1). Removing either the flexGrow or maxHeight settings allows window resizing without the exception.

geoffder avatar Nov 30 '20 20:11 geoffder

Having experimented a bit more I can narrow it down a bit, it seems to only occur when all flexGrows in the box are 0, while the one with a corresponding maxHeight is set to 1. Setting each (or at least one of the others) to 1, then using a large flexGrow (like 100) for the one which is supposed to be taking up the space has allowed resizing while achieving the desired layout. e.g.

header: flexGrow 0
contents: flexGrow 1; maxHeight x
footer: flexGrow 0

Leads to the exception, while the following does not.

header: flexGrow 0 (or 1)
contents: flexGrow 100; maxHeight x
footer: flexGrow 1

geoffder avatar Nov 30 '20 21:11 geoffder