Open kud1ing opened 3 months ago
This panic was in debug mode. In release mode there are lots of errors/warnings instead:
17:57:28.473Z ERROR layout: Error in #87: trying to call 'child_baseline_offset' with child 'Flex' #52 before computing its layout
17:57:28.473Z ERROR layout: Error in #87: trying to call 'child_size' with child 'Flex' #52 before computing its layout
17:57:28.473Z ERROR layout: Error in #87: trying to call 'place_child' with child 'Flex' #52 before computing its layout
17:57:28.474Z ERROR layout: Error in #88: trying to call 'place_child' with child 'Flex' #87 before computing its layout
17:57:28.474Z ERROR Error in #88: trying to call 'place_child' with child 'RootWidget' #88 before computing its layout
17:57:28.474Z WARN Widget requested layout during layout pass
17:57:28.580Z ERROR layout: Error in #87: trying to call 'child_baseline_offset' with child 'Flex' #52 before computing its layout
17:57:28.580Z ERROR layout: Error in #87: trying to call 'child_size' with child 'Flex' #52 before computing its layout
17:57:28.580Z ERROR layout: Error in #87: trying to call 'place_child' with child 'Flex' #52 before computing its layout
17:57:28.580Z ERROR layout: Error in #88: trying to call 'place_child' with child 'Flex' #87 before computing its layout
17:57:28.580Z ERROR Error in #88: trying to call 'place_child' with child 'RootWidget' #88 before computing its layout
17:57:28.580Z WARN Widget requested layout during layout pass
17:57:29.789Z ERROR layout: Error in #87: trying to call 'child_baseline_offset' with child 'Flex' #52 before computing its layout
17:57:29.789Z ERROR layout: Error in #87: trying to call 'child_size' with child 'Flex' #52 before computing its layout
17:57:29.789Z ERROR layout: Error in #87: trying to call 'place_child' with child 'Flex' #52 before computing its layout
17:57:29.789Z ERROR layout: Error in #88: trying to call 'place_child' with child 'Flex' #87 before computing its layout
17:57:29.789Z ERROR Error in #88: trying to call 'place_child' with child 'RootWidget' #88 before computing its layout
For me, just hovering over buttons is enough to trigger a crash from this.
Error in #87: trying to call 'child_baseline_offset' with child 'Flex' #69 before computing its layout
Thanks for the reports. Are you resizing using a keyboard shortcut rather than the by dragging with the mouse? I can reproduce in that case. I don't know why there should be a settling process in the flex implementation; there might be a caching issue?
The panic @jaredoconnell is related to the hot state. This should be resolved when we implement https://github.com/linebender/rfcs/pull/7, and isn't really possible to fix before then without changing the behaviour of the buttons to not have a border.
This occurs because in calc
the buttons add a border/change the border colour when they are hovered over, which requests a layout. And this hot state can be updated in layout, especially if widgets moved around during it.
Thank you for your reply.
Are you resizing using a keyboard shortcut rather than the by dragging with the mouse?
I was using the mouse at the window borders/corner to trigger the panic. It's reproducible best when run in debug mode and resizing both window width and height. Sometimes it didn't occur but reappeared after restarting the calc example. Could be a race condition or even undefined behaviour.
The jumpy relayouting when resizing the window height is always reproducible.
Right. I guess your desktop environment is bringing the mouse inside the window as you drag it. I think the crash is the same issue @jaredoconnell is reporting.
Can you provide a video showing the jumpy resizing you're seeing - the effect seemed very subtle to me, and I couldn't notice it just using the mouse.
In the last few seconds you can see another subtlety: the hovering marker of the button changes.
I've first come across the vertical jumpiness/jitteryness with https://github.com/veniamin-ilmer/minesweeper_xilem. But now i suppose it's a problem with the fundamental layouting.
Changing the window height leads to jumpy relayouting. This does not happen with changing the window width.
Changing window width and height eventually leads to a panic.