YGNodeFree: mark parent dirty when child is freed#1969
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hi @harsha-cpp! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
i have signed the CLA |
7b3194c to
473fc15
Compare
cipolleschi
left a comment
There was a problem hiding this comment.
Thanks for the contribution
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D107895988. |
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: 5dce726e13147e8b7735bf72c441e80bb0c9b5a3
|
@cipolleschi merged this pull request in f6206ec. |
fixes #1659.
problem:
YGNodeFreecalledowner->removeChild(node)to detach the node from itsparent, but never called
owner->markDirtyAndPropagate(). the parent's layout stayedstale after the free, so a subsequent
YGNodeCalculateLayoutwouldn't recompute it.YGNodeRemoveChildhas always calledmarkDirtyAndPropagate—YGNodeFreewas justmissing the same call.
YGNodeFreeRecursivewas already correct for its recursive child removals (it callsYGNodeRemoveChildinternally), but the terminalYGNodeFree(root)inherited the bug.fix: added
owner->markDirtyAndPropagate()afternode->setOwner(nullptr)inYGNodeFree.regression tests:
dirty_parent_when_child_freedanddirty_parent_when_subtree_freed_recursivein
YGDirtyMarkingTest.cpp.