Open robbert-ef opened 1 month ago
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 separate YGNodeFinalize
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 like YGNodeRelease
. I think it could be done in a backwards-compatible way.
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.