[Bugfix] UIEntity.set_grid() missing spatial hash cleanup on grid transfer #274
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#274
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
UIEntity::set_grid()(theentity.grid = new_gridproperty setter) removes the entity from the old grid's entity list but does not remove it from the old grid's spatial hash, and does not insert it into the new grid's spatial hash. This leaves a stale spatial hash entry that can cause incorrect collision/pathfinding results or use-after-free.Root Cause
UIEntity.cpp:691-717(set_grid):Working comparison —
UIEntityCollection::append()(lines 558-579) does this correctly:Reproduction
Fix
Add spatial hash operations:
Severity
High — causes incorrect spatial lookups. Stale spatial hash entries can reference positions in the old grid, leading to wrong collision results or index-out-of-bounds in the spatial hash.