|
From: <xf...@us...> - 2014-01-18 14:07:24
|
Revision: 1882
http://sourceforge.net/p/scstudio/code/1882
Author: xfarmad
Date: 2014-01-18 14:07:22 +0000 (Sat, 18 Jan 2014)
Log Message:
-----------
fix: layout_optimizer.cpp memory-leak
Modified Paths:
--------------
trunk/src/data/beautify/layout_optimizer.cpp
Modified: trunk/src/data/beautify/layout_optimizer.cpp
===================================================================
--- trunk/src/data/beautify/layout_optimizer.cpp 2014-01-16 21:35:00 UTC (rev 1881)
+++ trunk/src/data/beautify/layout_optimizer.cpp 2014-01-18 14:07:22 UTC (rev 1882)
@@ -810,12 +810,31 @@
return max_y;
}
+void remove_inst_cor_attributes(InstancePtrVector instances)
+{
+ //remove attributes of instances
+ for(InstancePtrVector::const_iterator it = instances.begin(); it != instances.end(); it++)
+ {
+ (*it)->remove_attribute<unsigned>("be_id");
+ (*it)->remove_attribute<unsigned>("id");
+
+ const EventAreaPtrList& areas = (*it)->get_areas();
+ for (EventAreaPtrList::const_iterator i = areas.begin(); i != areas.end(); ++i)
+ {
+ CoregionAreaPtr coregion = boost::dynamic_pointer_cast<CoregionArea>(*it);
+ if(coregion != NULL)
+ coregion->remove_attribute<unsigned>("id");
+ }
+ }
+}
+
void remove_inst_cor_attributes(InstancePtrList instances)
{
//remove attributes of instances
for(InstancePtrList::const_iterator it = instances.begin(); it != instances.end(); it++)
{
(*it)->remove_attribute<unsigned>("be_id");
+ (*it)->remove_attribute<unsigned>("id");
const EventAreaPtrList& areas = (*it)->get_areas();
for (EventAreaPtrList::const_iterator i = areas.begin(); i != areas.end(); ++i)
@@ -1115,6 +1134,9 @@
(*it)->set_line_end(MscPoint((*it)->get_line_end().get_x(),
(*it)-> get_line_begin().get_y() + max_instance_length));
}
+
+ // to delete instace attributes created in index_instances() function
+ remove_inst_cor_attributes(instances);
remove_inst_cor_attributes(bmsc->get_instances());
delete[] var;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|