[Bugfix] EntityCollection.append() skips gridstate resize when entity has existing gridstate #258
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#258
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
UIEntityCollection::append()only initializesgridstatewhengridstate.size() == 0. When an entity moves between grids of different sizes (e.g., 10×10 → 50×50), the existing gridstate keeps its old size. SubsequentupdateVisibility()writes past the end of the undersized vector, causing heap corruption.Root Cause
UIEntityCollection.cpp:582:The
size() == 0guard skips the resize when the entity already has gridstate from a previous grid. This is the same class of bug that was fixed inUIEntity::set_grid()— the fix there was to always resize to match the new grid dimensions.Reproduction
Fix
Replace the
size() == 0guard with unconditional resize to match the new grid:Severity
Critical — heap buffer overflow leading to nondeterministic crashes (segfault in PythonObjectCache rehash, UIFrame::render, etc.)
Related
Same class of bug as the
UIEntity::set_grid()fix applied during 7DRL 2026. See also bugs in.extend()and.insert()with the same pattern.