Skip to content

Fix Widget changed layer_id panic when undocking tabs (debug builds)#318

Open
mcthesw wants to merge 1 commit intoanhosh:mainfrom
mcthesw:fix/tab-body-ids-across-surfaces
Open

Fix Widget changed layer_id panic when undocking tabs (debug builds)#318
mcthesw wants to merge 1 commit intoanhosh:mainfrom
mcthesw:fix/tab-body-ids-across-surfaces

Conversation

@mcthesw
Copy link
Copy Markdown

@mcthesw mcthesw commented Apr 14, 2026

Problem

The tab body Ui was constructed with an ID that didn't include the surface:

let id = self.id.with(tab_viewer.id(tab));

When a tab is moved to a floating window surface, both the main dock (Background layer) and the window (Middle layer) can render a tab body with the same ID in the same frame. egui's debug assertion then fires because it sees the same widget ID appearing in two different layers.

Fix

Scope the tab body ID by surface:

fn tab_body_id(dock_area_id: Id, path: NodePath, tab_id: Id) -> Id {
    dock_area_id.with((path.surface, "surface")).with(tab_id)
}

This preserves the original property that tab IDs remain stable when a tab is moved between nodes on the same surface, while ensuring tabs on different surfaces get distinct IDs.

PixPin_2026-04-15_00-29-26

closes #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widget changed layer_id during the frame panic when dragging tab into floating window (only debug builds)

1 participant