[Bugfix] UICollection mutations don't invalidate parent Frame's render cache #288
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#288
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?
Bug
When a Frame uses
clip_children=Trueorcache_subtree=True, its children are rendered to a RenderTexture. The texture is only rebuilt whenrender_dirty == true. After the first render,render_dirtyis set tofalse(UIFrame.cpp:193).No UICollection mutation method sets
render_dirtyback totrueon the owning Frame. The collection has access to the owner viaself->owner(aweak_ptr<UIDrawable>), but never callsowner->markContentDirty().Affected methods (UICollection.cpp)
All of these modify the children vector but never dirty the parent:
append()(line ~619)remove()(line ~704)pop()(line ~714)insert()(line ~746)extend()/inplace_concat()(line ~647)setitem()(line ~264) — replacing a child at indexass_subscript()— slice assignmentEach calls
McRFPy_API::markSceneNeedsSort()(scene-level z-index sorting), but that has nothing to do with Frame render cache invalidation.Reproduction
Fix
Each mutation method should call
markContentDirty()on the owner after modifying the vector:Same pattern for
append,pop,insert,extend,setitem, and slice operations.Impact
This is invisible when
clip_children=False(the default) because the standard render path atUIFrame.cpp:248iterates the live vector every frame. It only manifests with render caching enabled, making it a confusing intermittent bug that depends on an unrelated flag.