[Lemon-commits] [lemon_svn] hegyi: r2462 - hugo/trunk/gui

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


Author: hegyi
Date: Mon Jan  9 13:41:06 2006
New Revision: 2462

Modified:
   hugo/trunk/gui/new_map_win.cc
   hugo/trunk/gui/new_map_win.h

Log:
The tree that is created for evaluation of expression string at new map creation is deleted after usage.

Modified: hugo/trunk/gui/new_map_win.cc
==============================================================================
--- hugo/trunk/gui/new_map_win.cc	(original)
+++ hugo/trunk/gui/new_map_win.cc	Mon Jan  9 13:41:06 2006
@@ -159,8 +159,6 @@
 
 	      //display it
 	      //gdc.changeEdgeText(mapname);
-
-	      //delete emptr;
 	    }
 	  else //!edge.get_active()
 	    {
@@ -240,8 +238,6 @@
 
 	      //display it
 	      //gdc.changeNodeText(mapname);
-
-	      //delete emptr;
 	    }
 	  if(!abortion)
 	    {
@@ -374,11 +370,26 @@
 
       std::string polishform=postOrder(root);
 
+      deleteTree(root);
+
       return polishform;
     }
   return "";
 }
 
+void NewMapWin::deleteTree(NewMapWin::tree_node * node)
+{
+  if(node->left_child!=NULL)
+    {
+      deleteTree(node->left_child);
+    }
+  if(node->right_child!=NULL)
+    {
+      deleteTree(node->right_child);
+    }
+  delete node;
+}
+
 NewMapWin::tree_node * NewMapWin::weightedString2Tree(std::string to_tree, std::vector<unsigned int> & p, int offset)
 {
   unsigned int min=p[offset];

Modified: hugo/trunk/gui/new_map_win.h
==============================================================================
--- hugo/trunk/gui/new_map_win.h	(original)
+++ hugo/trunk/gui/new_map_win.h	Mon Jan  9 13:41:06 2006
@@ -28,7 +28,7 @@
   
   ///Constructor of NewMapWin creates the widgets shown in NewMapWin.
   NewMapWin(const std::string& title, NoteBookTab &, bool itisedge=true, bool edgenode=true);
-  
+
   ///Signal on button is connected to this function,
   ///Therefore this function determines whether to
   ///call the map/creatort function, and if yes, it
@@ -47,6 +47,8 @@
 
   bool validVariable(std::string, bool);
 
+  void deleteTree(tree_node *);
+
   std::map<char, std::string> ch2var;
 
   Gtk::Entry name, default_value;



More information about the Lemon-commits mailing list