File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,9 @@ static void YGConfigFreeRecursive(const YGNodeRef root) {
319
319
}
320
320
}
321
321
322
- void YGNodeFreeRecursive (const YGNodeRef root) {
322
+ void YGNodeFreeRecursiveWithCleanupFunc (
323
+ const YGNodeRef root,
324
+ YGNodeCleanupFunc cleanup) {
323
325
while (YGNodeGetChildCount (root) > 0 ) {
324
326
const YGNodeRef child = YGNodeGetChild (root, 0 );
325
327
if (child->getOwner () != root) {
@@ -329,9 +331,16 @@ void YGNodeFreeRecursive(const YGNodeRef root) {
329
331
YGNodeRemoveChild (root, child);
330
332
YGNodeFreeRecursive (child);
331
333
}
334
+ if (cleanup != nullptr ) {
335
+ cleanup (root);
336
+ }
332
337
YGNodeFree (root);
333
338
}
334
339
340
+ void YGNodeFreeRecursive (const YGNodeRef root) {
341
+ return YGNodeFreeRecursiveWithCleanupFunc (root, nullptr );
342
+ }
343
+
335
344
void YGNodeReset (const YGNodeRef node) {
336
345
YGAssertWithNode (
337
346
node,
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ typedef float (
70
70
*YGBaselineFunc)(YGNodeRef node, const float width, const float height);
71
71
typedef void (*YGDirtiedFunc)(YGNodeRef node);
72
72
typedef void (*YGPrintFunc)(YGNodeRef node);
73
+ typedef void (*YGNodeCleanupFunc)(YGNodeRef node);
73
74
typedef int (*YGLogger)(
74
75
const YGConfigRef config,
75
76
const YGNodeRef node,
@@ -84,6 +85,9 @@ WIN_EXPORT YGNodeRef YGNodeNew(void);
84
85
WIN_EXPORT YGNodeRef YGNodeNewWithConfig (const YGConfigRef config);
85
86
WIN_EXPORT YGNodeRef YGNodeClone (const YGNodeRef node);
86
87
WIN_EXPORT void YGNodeFree (const YGNodeRef node);
88
+ WIN_EXPORT void YGNodeFreeRecursiveWithCleanupFunc (
89
+ const YGNodeRef node,
90
+ YGNodeCleanupFunc cleanup);
87
91
WIN_EXPORT void YGNodeFreeRecursive (const YGNodeRef node);
88
92
WIN_EXPORT void YGNodeReset (const YGNodeRef node);
89
93
WIN_EXPORT int32_t YGNodeGetInstanceCount (void );
You can’t perform that action at this time.
0 commit comments