Fixed memory leak in ResourceSaveLoadMathGraphInputs test.
parent
e687c9b613
commit
3a7f470acf
|
@ -42,11 +42,24 @@ struct BlendTreeResource {
|
||||||
std::vector<AnimNodeResource> m_nodes;
|
std::vector<AnimNodeResource> m_nodes;
|
||||||
std::vector<BlendTreeConnectionResource> m_connections;
|
std::vector<BlendTreeConnectionResource> m_connections;
|
||||||
|
|
||||||
|
~BlendTreeResource() { CleanupNodes();
|
||||||
|
}
|
||||||
|
|
||||||
void Reset() {
|
void Reset() {
|
||||||
m_nodes.clear();
|
CleanupNodes();
|
||||||
|
|
||||||
m_connections.clear();
|
m_connections.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CleanupNodes() {
|
||||||
|
for (AnimNodeResource& node_resource : m_nodes) {
|
||||||
|
delete node_resource.m_anim_node;
|
||||||
|
delete node_resource.m_socket_accessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_nodes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void InitGraphConnectors() {
|
void InitGraphConnectors() {
|
||||||
m_nodes.push_back(AnimNodeResourceFactory("BlendTree"));
|
m_nodes.push_back(AnimNodeResourceFactory("BlendTree"));
|
||||||
m_nodes[0].m_name = "Outputs";
|
m_nodes[0].m_name = "Outputs";
|
||||||
|
|
|
@ -413,7 +413,7 @@ TEST_CASE("ResourceSaveLoadMathGraphInputs", "[AnimGraphResource]") {
|
||||||
AnimGraphResource graph_resource_loaded;
|
AnimGraphResource graph_resource_loaded;
|
||||||
graph_resource_loaded.LoadFromFile(filename);
|
graph_resource_loaded.LoadFromFile(filename);
|
||||||
|
|
||||||
BlendTreeResource graph_blend_tree_loaded = graph_resource_loaded.m_blend_tree_resource;
|
BlendTreeResource& graph_blend_tree_loaded = graph_resource_loaded.m_blend_tree_resource;
|
||||||
|
|
||||||
const AnimNodeResource& graph_loaded_output_node =
|
const AnimNodeResource& graph_loaded_output_node =
|
||||||
graph_blend_tree_loaded.m_nodes[0];
|
graph_blend_tree_loaded.m_nodes[0];
|
||||||
|
|
Loading…
Reference in New Issue