[Lemon-commits] [lemon_svn] ladanyi: r2375 - hugo/trunk/gui

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:52:11 CET 2006


Author: ladanyi
Date: Tue Nov 22 11:27:25 2005
New Revision: 2375

Modified:
   hugo/trunk/gui/graph_displayer_canvas-edge.cc
   hugo/trunk/gui/graph_displayer_canvas-node.cc

Log:
fixed some memory leaks

Modified: hugo/trunk/gui/graph_displayer_canvas-edge.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-edge.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-edge.cc	Tue Nov 22 11:27:25 2005
@@ -4,18 +4,17 @@
 
 int GraphDisplayerCanvas::resetEdgeWidth (Edge edge)
 {
-  Graph::EdgeMap<double> * actual_map;
   double min, max;
 
   min=edge_property_defaults[E_WIDTH];
   max=edge_property_defaults[E_WIDTH];
-  actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_WIDTH]);
+  Graph::EdgeMap<double> actual_map(mapstorage.graph,edge_property_defaults[E_WIDTH]);
   
   if(edge==INVALID)
     {
       for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
 	{
-	  double v=fabs((*actual_map)[i]);
+	  double v=fabs(actual_map[i]);
 	  int w;
 	  if(min==max)
 	    {
@@ -30,7 +29,7 @@
     }
   else
     {
-      int w=(int)(*actual_map)[edge];
+      int w=(int)actual_map[edge];
       if(w>=0)
 	{
 	  edgesmap[edge]->property_width_units().set_value(w);
@@ -135,8 +134,7 @@
   //function maps the range of the maximum and
   //the minimum of the nodemap to the range of
   //green in RGB
-  Graph::EdgeMap<double> * actual_map;
-  actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_COLOR]);
+  Graph::EdgeMap<double> actual_map(mapstorage.graph,edge_property_defaults[E_COLOR]);
 
   double max, min;
 
@@ -147,7 +145,7 @@
     {
       for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
 	{
-	  double w=(*actual_map)[i];
+	  double w=actual_map[i];
 
 	  Gdk::Color color;
 	  if(max!=min)
@@ -165,7 +163,7 @@
     {
       Gdk::Color color;
 
-      double w=(*actual_map)[edge];
+      double w=actual_map[edge];
 
       if(max!=min)
 	{

Modified: hugo/trunk/gui/graph_displayer_canvas-node.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-node.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-node.cc	Tue Nov 22 11:27:25 2005
@@ -61,17 +61,16 @@
 
 int GraphDisplayerCanvas::resetNodeRadius (Node node)
 {
-  Graph::NodeMap<double> * actual_map;
   double min, max;
   min=node_property_defaults[N_RADIUS];
   max=node_property_defaults[N_RADIUS];
-  actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]);
+  Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_RADIUS]);
   
   if(node==INVALID)
     {
       for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
 	{
-	  double v=fabs((*actual_map)[i]);
+	  double v=fabs(actual_map[i]);
 	  int w;
 	  if(min==max)
 	    {
@@ -98,7 +97,7 @@
   else
     {
       //I think only new nodes use this case
-//       int w=(int)(*actual_map)[node];
+//       int w=(int)actual_map[node];
       int w=(int)(node_property_defaults[N_RADIUS]);
       if(w>=0)
 	{
@@ -179,8 +178,7 @@
   //the minimum of the nodemap to the range of
   //green in RGB
 
-  Graph::NodeMap<double> * actual_map;
-  actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]);
+  Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_COLOR]);
 
   double max, min;
 
@@ -194,7 +192,7 @@
 	{
 	  Gdk::Color color;
 
-	  double w=(*actual_map)[i];
+	  double w=actual_map[i];
 
 	  if(max!=min)
 	    {
@@ -212,7 +210,7 @@
     {
       Gdk::Color color;
 
-      double w=(*actual_map)[node];
+      double w=actual_map[node];
 
       if(max!=min)
 	{



More information about the Lemon-commits mailing list