YGNodeFree does not mark parent as dirty #1659
Reference in New Issue
Block a user
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?
Report
Issues and Steps to Reproduce
Expected Behavior
I would expect
YGNodeFree
andYGNodeFreeRecursive
to always mark its parents as dirty as it affects the positioning and sizing of other nodes.Actual Behavior
YGNodeFree
never marks its parent as dirtyYGNodeFreeRecursive
only marks its parents as dirty when it has children, this is because it callsYGNodeRemoveChild
which marks the parent as dirty.This seems like a sane enough behavior to change, with the current model where
YGNodeFree
will mutate the tree around it to disconnect the node first.An aside, I don't like that
YGNodeFree
manipulates the tree around it, instead of just freeing the node. E.g., we needed to add a separateYGNodeFinalize
which doesn't do this, because GC'ing Yoga nodes could happen in parallel in Java bindings. It's probably not worth breaking the existing folks relying on this behavior, but I would consider doing any sort of unhooking of nodes from your Yoga tree, before freeing parts of it.Probably not going to happen any time soon, but I have had some desire to add an intrinsic ref-count to the nodes, and deprecate
YGNodeFree
for something likeYGNodeRelease
. I think it could be done in a backwards-compatible way.