Update CSSNodeFree for C#, Java and Objective-C

Summary:
- Update CSSNodeFree to unlink parent and children for C#, Java and Objective-C bindings finalizer.
- [C#] Fix build (Fix #232)
- [C#] Add Clear API for convenience as CSSNodeFreeRecursive.
- [C#] Revise and add unit tests

Reviewed By: emilsjolander

Differential Revision: D4069655

fbshipit-source-id: 1fd764059784d7968af38b6aaf7fb6f70fdee8ee
This commit is contained in:
Kazuki Sakamoto
2016-10-25 07:38:06 -07:00
committed by Facebook Github Bot
parent 4d0e657653
commit 2168d68007
3 changed files with 67 additions and 94 deletions

View File

@@ -155,6 +155,17 @@ CSSNodeRef CSSNodeNew(void) {
}
void CSSNodeFree(const CSSNodeRef node) {
if (node->parent) {
CSSNodeListDelete(node->parent->children, node);
node->parent = NULL;
}
const uint32_t childCount = CSSNodeChildCount(node);
for (uint32_t i = 0; i < childCount; i++) {
const CSSNodeRef child = CSSNodeGetChild(node, i);
child->parent = NULL;
}
CSSNodeListFree(node->children);
free(node);
gNodeInstanceCount--;