Revert "Do not call malloc during terminate" 02/309602/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 12 Apr 2024 10:25:43 +0000 (19:25 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 12 Apr 2024 10:26:10 +0000 (19:26 +0900)
This reverts commit cc221e4f8a66b6748e5c737e5dbde82c68db8d48.

Change-Id: Ib0dd44b9ca2a82738bfb1cc1a12528803327b1fa

dali-toolkit/internal/builder/tree-node-manipulator.cpp
dali-toolkit/internal/builder/tree-node-manipulator.h

index aa23c76..3f7e73e 100644 (file)
@@ -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;
index 24599a5..b231302 100644 (file)
@@ -215,29 +215,6 @@ struct CollectNodes
 };
 
 /*
- * Delete nodes immediately, instead of self
- */
-struct DeleteNodesWithoutSelf
-{
-  DeleteNodesWithoutSelf(TreeNode* self)
-  : mSelf(self){};
-
-  /*
-   * Call operator to delete object if given node is not self
-   */
-  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<typename Operation>