Skip to content

Panic when resizing vertically docked tabbed windows to narrow width #290

@ashley-breen

Description

@ashley-breen

Hi, seeing an issue with 0.17.0 of egui_dock.

Describe the bug
If there are 4 tabbed windows arranged with 3 vertical splits and the leftmost split is dragged towards the right-hand side, there is a point where the tabbed windows on the right are resized to a width that causes a panic.

Image

thread 'main' panicked at C:\ncrdev\rust\egui_dock\src\widgets\dock_area\show\leaf.rs:1104:9:
assertion left != right failed
left: 0.0
right: 0.0

To Reproduce
Steps to reproduce the behavior:

  1. In the egui_dock main branch v0.17.0, build the examples using debug target. Rustc version is 1.89.0. Toolchain is stable-x86_64-pc-windows-msvc.
  2. Run simple.exe - should see this initially:
Image
  1. Change the dock positions so the tabbed windows are docked vertically:
Image
  1. Move the split between tab3 and tab1/tab2 window to the left reasonably slowly
Image
  1. As the width of tab1/tab3, tab5 and tab4 decreases, eventually a panic occurs
  2. The output shows:
    thread 'main' panicked at C:\ncrdev\rust\egui_dock\src\widgets\dock_area\show\leaf.rs:1104:9:
    assertion left != right failed
    left: 0.0
    right: 0.0

Expected behavior
Can resize the tabbed window width without panic OR the minimum_width style for a tab is adhered to as the separators are dragged. https://docs.rs/egui_dock/0.17.0/egui_dock/style/struct.TabStyle.html. Setting the minimum_width does not solve the issue - seems to be ignored as separators are dragged.

Screenshots
See above.

Additional context
The panic is on this line here in tab_bar_scroll(): https://github.com/Adanos020/egui_dock/blob/main/src/widgets/dock_area/show/leaf.rs#L1104
The available_width can end up being set to 0 in these lines here in tab_bar(): https://github.com/Adanos020/egui_dock/blob/main/src/widgets/dock_area/show/leaf.rs#L125 where the Style::TAB_ADD_BUTTON_SIZE/Style::TAB_CLOSE_ALL_BUTTON_SIZE/Style::TAB_COLLAPSE_BUTTON_SIZE is taken away from the available_width.

Full backtrace attached:
egui_dock_tab_resize_bug_backtrace.txt

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions