[Tizen] Revert "Do not call malloc during terminate" 12/308912/1
authorEunki Hong <eunkiki.hong@samsung.com>
Tue, 2 Apr 2024 15:46:50 +0000 (00:46 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Tue, 2 Apr 2024 15:46:57 +0000 (00:46 +0900)
This reverts commit 4136ad045e9fec48e66b45999fb8ac19e325812f.

Change-Id: I0ba7d5ba19ab0c05506165332bccc814b02a8147

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 f881f58..0852497 100644 (file)
@@ -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<typename Operation>