fixed Order for to release graph modules.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user