|
@@ -308,6 +308,13 @@ static ExampleTreeNode* ExampleTree_CreateNode(const char* name, int uid, Exampl
|
|
return node;
|
|
return node;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void ExampleTree_DestroyNode(ExampleTreeNode* node)
|
|
|
|
+{
|
|
|
|
+ for (ExampleTreeNode* child_node : node->Childs)
|
|
|
|
+ ExampleTree_DestroyNode(child_node);
|
|
|
|
+ IM_DELETE(node);
|
|
|
|
+}
|
|
|
|
+
|
|
// Create example tree data
|
|
// Create example tree data
|
|
// (this allocates _many_ more times than most other code in either Dear ImGui or others demo)
|
|
// (this allocates _many_ more times than most other code in either Dear ImGui or others demo)
|
|
static ExampleTreeNode* ExampleTree_CreateDemoTree()
|
|
static ExampleTreeNode* ExampleTree_CreateDemoTree()
|
|
@@ -343,7 +350,7 @@ static ExampleTreeNode* ExampleTree_CreateDemoTree()
|
|
// [SECTION] Demo Window / ShowDemoWindow()
|
|
// [SECTION] Demo Window / ShowDemoWindow()
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
-// Data to be shared accross different functions of the demo.
|
|
|
|
|
|
+// Data to be shared across different functions of the demo.
|
|
struct ImGuiDemoWindowData
|
|
struct ImGuiDemoWindowData
|
|
{
|
|
{
|
|
// Examples Apps (accessible from the "Examples" menu)
|
|
// Examples Apps (accessible from the "Examples" menu)
|
|
@@ -371,6 +378,8 @@ struct ImGuiDemoWindowData
|
|
|
|
|
|
// Other data
|
|
// Other data
|
|
ExampleTreeNode* DemoTree = NULL;
|
|
ExampleTreeNode* DemoTree = NULL;
|
|
|
|
+
|
|
|
|
+ ~ImGuiDemoWindowData() { if (DemoTree) ExampleTree_DestroyNode(DemoTree); }
|
|
};
|
|
};
|
|
|
|
|
|
// Demonstrate most Dear ImGui features (this is big function!)
|
|
// Demonstrate most Dear ImGui features (this is big function!)
|