fixed some memory leaks
authorladanyi
Tue, 22 Nov 2005 10:27:25 +0000
changeset 1825535d2eccfc03
parent 1824 3a15b39a7c78
child 1826 e07a7a8acd77
fixed some memory leaks
gui/graph_displayer_canvas-edge.cc
gui/graph_displayer_canvas-node.cc
     1.1 --- a/gui/graph_displayer_canvas-edge.cc	Mon Nov 21 18:12:11 2005 +0000
     1.2 +++ b/gui/graph_displayer_canvas-edge.cc	Tue Nov 22 10:27:25 2005 +0000
     1.3 @@ -4,18 +4,17 @@
     1.4  
     1.5  int GraphDisplayerCanvas::resetEdgeWidth (Edge edge)
     1.6  {
     1.7 -  Graph::EdgeMap<double> * actual_map;
     1.8    double min, max;
     1.9  
    1.10    min=edge_property_defaults[E_WIDTH];
    1.11    max=edge_property_defaults[E_WIDTH];
    1.12 -  actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_WIDTH]);
    1.13 +  Graph::EdgeMap<double> actual_map(mapstorage.graph,edge_property_defaults[E_WIDTH]);
    1.14    
    1.15    if(edge==INVALID)
    1.16      {
    1.17        for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
    1.18  	{
    1.19 -	  double v=fabs((*actual_map)[i]);
    1.20 +	  double v=fabs(actual_map[i]);
    1.21  	  int w;
    1.22  	  if(min==max)
    1.23  	    {
    1.24 @@ -30,7 +29,7 @@
    1.25      }
    1.26    else
    1.27      {
    1.28 -      int w=(int)(*actual_map)[edge];
    1.29 +      int w=(int)actual_map[edge];
    1.30        if(w>=0)
    1.31  	{
    1.32  	  edgesmap[edge]->property_width_units().set_value(w);
    1.33 @@ -135,8 +134,7 @@
    1.34    //function maps the range of the maximum and
    1.35    //the minimum of the nodemap to the range of
    1.36    //green in RGB
    1.37 -  Graph::EdgeMap<double> * actual_map;
    1.38 -  actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_COLOR]);
    1.39 +  Graph::EdgeMap<double> actual_map(mapstorage.graph,edge_property_defaults[E_COLOR]);
    1.40  
    1.41    double max, min;
    1.42  
    1.43 @@ -147,7 +145,7 @@
    1.44      {
    1.45        for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
    1.46  	{
    1.47 -	  double w=(*actual_map)[i];
    1.48 +	  double w=actual_map[i];
    1.49  
    1.50  	  Gdk::Color color;
    1.51  	  if(max!=min)
    1.52 @@ -165,7 +163,7 @@
    1.53      {
    1.54        Gdk::Color color;
    1.55  
    1.56 -      double w=(*actual_map)[edge];
    1.57 +      double w=actual_map[edge];
    1.58  
    1.59        if(max!=min)
    1.60  	{
     2.1 --- a/gui/graph_displayer_canvas-node.cc	Mon Nov 21 18:12:11 2005 +0000
     2.2 +++ b/gui/graph_displayer_canvas-node.cc	Tue Nov 22 10:27:25 2005 +0000
     2.3 @@ -61,17 +61,16 @@
     2.4  
     2.5  int GraphDisplayerCanvas::resetNodeRadius (Node node)
     2.6  {
     2.7 -  Graph::NodeMap<double> * actual_map;
     2.8    double min, max;
     2.9    min=node_property_defaults[N_RADIUS];
    2.10    max=node_property_defaults[N_RADIUS];
    2.11 -  actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]);
    2.12 +  Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_RADIUS]);
    2.13    
    2.14    if(node==INVALID)
    2.15      {
    2.16        for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
    2.17  	{
    2.18 -	  double v=fabs((*actual_map)[i]);
    2.19 +	  double v=fabs(actual_map[i]);
    2.20  	  int w;
    2.21  	  if(min==max)
    2.22  	    {
    2.23 @@ -98,7 +97,7 @@
    2.24    else
    2.25      {
    2.26        //I think only new nodes use this case
    2.27 -//       int w=(int)(*actual_map)[node];
    2.28 +//       int w=(int)actual_map[node];
    2.29        int w=(int)(node_property_defaults[N_RADIUS]);
    2.30        if(w>=0)
    2.31  	{
    2.32 @@ -179,8 +178,7 @@
    2.33    //the minimum of the nodemap to the range of
    2.34    //green in RGB
    2.35  
    2.36 -  Graph::NodeMap<double> * actual_map;
    2.37 -  actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]);
    2.38 +  Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_COLOR]);
    2.39  
    2.40    double max, min;
    2.41  
    2.42 @@ -194,7 +192,7 @@
    2.43  	{
    2.44  	  Gdk::Color color;
    2.45  
    2.46 -	  double w=(*actual_map)[i];
    2.47 +	  double w=actual_map[i];
    2.48  
    2.49  	  if(max!=min)
    2.50  	    {
    2.51 @@ -212,7 +210,7 @@
    2.52      {
    2.53        Gdk::Color color;
    2.54  
    2.55 -      double w=(*actual_map)[node];
    2.56 +      double w=actual_map[node];
    2.57  
    2.58        if(max!=min)
    2.59  	{