Skip to content

Panic when restoring state. #287

@hydra

Description

@hydra

Describe the bug
in my app, I had programatically closed some tabs, then quit the program; which will have saved state, then restarted it again and I get a panic in egui itself.

available_from_cursor_max_rect - layout.rs:520

debug_assert!(!avail.any_nan(), "avail is NaN: {avail:?}");

the stack trace has a bunch of other egui entries, and the first non-egui entry is:

10: egui_dock::widgets::dock_area::DockArea<planner_gui_egui::tabs::TabKey>::show_leaf<planner_gui_egui::tabs::TabKey,planner_gui_egui::tabs::AppTabViewer<planner_gui_egui::project::tabs::ProjectTabContext,enum2$<planner_gui_egui::project::ProjectTabKind> > >
             at D:\Users\Hydra\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\egui_dock-0.17.0\src\widgets\dock_area\show\leaf.rs:37

To Reproduce
Steps to reproduce the behavior:

  1. run makerpnp planner_egui_app (~commit: c708a7c1ec791ec4c8ba5e53188036c11b35eaef, https://github.com/MakerPnP/makerpnp)
  2. close it.
  3. replace the saved state (%appdata%\MakerPnP - Planner\data\app.ron) with the one attached.
  4. restart it.
  5. observe panic

Expected behavior
no panic.

Screenshots
Here's a debugger view, note the min/max on the rect being passed to UiBuilder

Image

Additional context
app - panic-when-restoring-layout-20250812.zip

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