# HG changeset patch # User hegyi # Date 1136810466 0 # Node ID 004b239908e621119f677dc4d31964e5804a3c44 # Parent 2bd795bb998423ff81303183c1521645d947a634 The tree that is created for evaluation of expression string at new map creation is deleted after usage. diff -r 2bd795bb9984 -r 004b239908e6 new_map_win.cc --- a/new_map_win.cc Mon Jan 09 11:55:47 2006 +0000 +++ b/new_map_win.cc Mon Jan 09 12:41:06 2006 +0000 @@ -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 & p, int offset) { unsigned int min=p[offset]; diff -r 2bd795bb9984 -r 004b239908e6 new_map_win.h --- a/new_map_win.h Mon Jan 09 11:55:47 2006 +0000 +++ b/new_map_win.h Mon Jan 09 12:41:06 2006 +0000 @@ -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 ch2var; Gtk::Entry name, default_value;