Commit f6206ec
YGNodeFree: mark parent dirty when child is freed (#1969)
Summary:
fixes #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
Pull Request resolved: #1969
Reviewed By: javache
Differential Revision: D107895988
Pulled By: cipolleschi
fbshipit-source-id: 5dce726e13147e8b7735bf72c441e80bb0c9b5a31 parent 96fc051 commit f6206ec
2 files changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 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