emilk / emilk/egui

Nested Windows can have surprisingly overlapping ids

Open
#5,573 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**
The following code crashes instantly. I believe the second id overlaps with https://github.com/emilk/egui/blob/4784136fee8a46db3761fc53c616e57db3cb615d/crates/egui/src/containers/area.rs#L457 . If you replace `"move"` with anything else, everything works.

**To Reproduce**
```rust
let id = egui::Id::new("foo");
egui::Window::new("Wow").id(id).show(ctx, |_ui| {
egui::Window::new("Bar")
.id(id.with("move"))
.show(ctx, |_ui| {});
});
```

**Expected behavior**
No crash.

**Desktop (please complete the following information):**
- OS: MacOS, eframe

Contributor guide

Open the contributing guide

Research direction

Start with the reproducer in issue #5573 and inspect crates/egui/src/containers/area.rs around line 457, where the reported ID overlap appears. Confirm the nested Window case crashes with id.with("move") but not with another string; done means the reproducer no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.