A region keeps its own name; only the name lookup is first-come (#944)

Region names lived in one first-wins name → id map that also served `GetName`, so a second region given a taken name answered `GetName()` with nil and was `<unnamed>` in its error strings.

In 1.12.1 the name lives on the region: `SetName` (`0x76c650`) keeps the region's own copy at `[+0x98]`, freed by its destructor (`0x76c560`) and read back by `GetName`. Only `_G` is first-come (`0x701bd0`, `0x701c8a`).

Each region now carries its name; `GetName` and the error strings read it directly, and the name map is a first-come lookup only, whose entry a free drops only when it holds that region.

Tests: same name twice, `$parentText` under colliding parents, the second region's error string, a free leaving a same-named sibling's name.

Fixes #939

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sam Sung
2026-10-12 04:17:03 +07:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 73623e31fa
commit 87bf5904ff
10 changed files with 177 additions and 35 deletions
+1 -1
View File
@@ -1198,7 +1198,7 @@ impl UiScript {
});
}
// Region leaves publish into their own name table, not the arena's.
let id = *model.region_names.get(name)?;
let id = *model.region_by_name.get(name)?;
let h = *model.id_to_region.get(&id)?;
model.arena.region(h).map(|r| match r.kind {
crate::widget::RegionKind::Texture => "Texture",