fixed Order for to release graph modules.

This commit is contained in:
2024-11-14 23:40:26 +08:00
parent fda5b629a2
commit abad1784c2
4 changed files with 32 additions and 10 deletions

View File

@@ -94,7 +94,10 @@ GraphModule *GraphModuleManager::GetModule(const AnsiIDName &name,bool create)
gm=CreateGraphModule(name,this);
if(gm)
{
graph_module_map.Add(name,gm);
module_list.Add(gm);
}
return gm;
}
@@ -104,10 +107,19 @@ GraphModule *GraphModuleManager::GetModule(const AnsiIDName &name,bool create)
GraphModuleManager::~GraphModuleManager()
{
for(auto *gm:graph_module_map)
//按顺序加入module_list的要倒着释放
GraphModule **gm=module_list.end();
while(gm>module_list.begin())
{
delete gm->value;
--gm;
delete *gm;
}
//其实下面释不释放都无所谓了
module_list.Clear();
graph_module_map.Clear();
}
void GraphModuleManager::ReleaseModule(GraphModule *gm)