Commit 4adca58
YGNodeFree: mark parent dirty when child is freed
Summary:
fixes react/yoga#1659.
**problem:** `YGNodeFree` called `owner->removeChild(node)` to detach the node from its
parent, but never called `owner->markDirtyAndPropagate()`. the parent's layout stayed
stale after the free, so a subsequent `YGNodeCalculateLayout` wouldn't recompute it.
`YGNodeRemoveChild` has always called `markDirtyAndPropagate` — `YGNodeFree` was just
missing the same call.
`YGNodeFreeRecursive` was already correct for its recursive child removals (it calls
`YGNodeRemoveChild` internally), but the terminal `YGNodeFree(root)` inherited the bug.
**fix:** added `owner->markDirtyAndPropagate()` after `node->setOwner(nullptr)` in
`YGNodeFree`.
regression tests: `dirty_parent_when_child_freed` and `dirty_parent_when_subtree_freed_recursive`
in `YGDirtyMarkingTest.cpp`.
bypass-github-export-checks
## Changelog
[General][Changed] - mark parent dirty when child is freed
X-link: react/yoga#1969
Reviewed By: javache
Differential Revision: D107895988
Pulled By: cipolleschi
fbshipit-source-id: 5dce726e13147e8b7735bf72c441e80bb0c9b5a31 parent b41fffd commit 4adca58
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
0 commit comments