[Bugfix] GridChunk::parent_grid raw pointer can dangle #277
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.
Depends on
#252
GridView and Grid, FOVLayer and PathLayer
john/McRogueFace
Reference
john/McRogueFace#277
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
GridChunkstores its parent grid as a rawUIGrid*pointer atGridChunk.h:39. This is the same class of bug asGridLayer::parent_grid(#270) — the raw pointer can dangle if the grid is destroyed while chunks are still referenced.Root Cause
GridChunk.h:39:And the parallel structure at line 72:
Risk
GridChunks are owned by the grid, so under normal operation they don't outlive their parent. However:
parent_gridpointer danglesFix
Same as #270 — convert to
std::weak_ptr<UIGrid>or document the ownership invariant. Since GridChunks are always owned by grids and never exposed to Python, this is lower priority than the GridLayer and UIGridPoint cases.Severity
Low — GridChunks are internal to UIGrid and not exposed to Python, so they generally can't outlive their parent grid. Fixing this is more about consistency than preventing crashes.
Related
GridViewandGrid,FOVLayerandPathLayerDeferred from the #258–#278 memory safety audit. GridChunk is internal to UIGrid and not Python-accessible, so the risk is low. In #252, the plan states GridChunk.h/cpp gets removed entirely — "GridPoint storage replaced by DiscreteMap slots." The chunk rendering architecture continues for layers but GridChunk's
parent_gridraw pointer ceases to exist. Linked as dependency of #252.GridViewandGrid,FOVLayerandPathLayer#252Roadmap context
Folded into #252 (Grid/GridView split) in the Grid & Entity Overhaul Roadmap (
docs/GRID_ENTITY_OVERHAUL_ROADMAP.md), Phase 4. RawUIGrid*in GridChunk will becomeweak_ptr<Grid>during the architecture overhaul.GridViewandGrid,FOVLayerandPathLayer#252