From e302656dce79e6d161cfb49ddf466feed57af658 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Wed, 3 Apr 2024 00:46:50 +0900 Subject: [PATCH] [Tizen] Revert "Do not call malloc during terminate" This reverts commit 4136ad045e9fec48e66b45999fb8ac19e325812f. Change-Id: I0ba7d5ba19ab0c05506165332bccc814b02a8147 --- .../internal/builder/tree-node-manipulator.cpp | 12 +++++++++-- .../internal/builder/tree-node-manipulator.h | 25 +--------------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/dali-toolkit/internal/builder/tree-node-manipulator.cpp b/dali-toolkit/internal/builder/tree-node-manipulator.cpp index aa23c76..3f7e73e 100644 --- a/dali-toolkit/internal/builder/tree-node-manipulator.cpp +++ b/dali-toolkit/internal/builder/tree-node-manipulator.cpp @@ -162,9 +162,17 @@ void TreeNodeManipulator::RemoveChildren() { DALI_ASSERT_DEBUG(mNode && "Operation on NULL JSON node"); - DeleteNodesWithoutSelf otherDeletor(mNode); + CollectNodes collector; - DepthFirst(mNode, otherDeletor); + DepthFirst(mNode, collector); + + for(CollectNodes::iterator iter = collector.nodes.begin(); iter != collector.nodes.end(); ++iter) + { + if(*iter != mNode) + { + delete *iter; + } + } mNode->mFirstChild = NULL; mNode->mLastChild = NULL; diff --git a/dali-toolkit/internal/builder/tree-node-manipulator.h b/dali-toolkit/internal/builder/tree-node-manipulator.h index f881f58..0852497 100644 --- a/dali-toolkit/internal/builder/tree-node-manipulator.h +++ b/dali-toolkit/internal/builder/tree-node-manipulator.h @@ -2,7 +2,7 @@ #define DALI_SCRIPT_TREE_NODE_MANIPULATOR_H /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -215,29 +215,6 @@ struct CollectNodes }; /* - * Delete nodes immediately, instead of self - */ -struct DeleteNodesWithoutSelf -{ - DeleteNodesWithoutSelf(TreeNode* self) - : mSelf(self){}; - - /* - * Call operator to add nodes to the list - */ - void operator()(TreeNode*& n) - { - DALI_ASSERT_DEBUG(n && "Operation on NULL JSON node"); - if(mSelf != n) - { - delete n; - } - } - - const TreeNode* mSelf; ///< self node what we should not remove. -}; - -/* * Depth first walk of nodes applying given operation (unary_function) */ template -- 2.7.4