[Bugfix] updateVisibility() gridstate.size()==0 guard doesn't validate against current grid dimensions #276
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#276
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::updateVisibility()has a lazy initialization guardif (gridstate.size() == 0)at line 41 that only initializes gridstate when it's completely empty. If the entity has gridstate from a previous grid of different size, this guard is skipped and the function proceeds to iterate using the current grid's dimensions — writing past the end of the undersized vector.While the primary fix for this class of bug is in the grid transfer entry points (set_grid, append, extend, insert, setitem, slice — see issues #258-#263),
updateVisibility()itself should have a defense-in-depth check.Root Cause
UIEntity.cpp:36-71:Fix
Change the guard to validate against the current grid dimensions:
This provides defense-in-depth: even if a grid transfer entry point misses the resize,
updateVisibility()will catch and correct the mismatch before iterating.Severity
Medium — defense-in-depth fix. The primary fixes are in the grid transfer methods, but this guards against any future code path that sets
entity->gridwithout resizing gridstate.Related