# HG changeset patch # User hegyi # Date 1136810466 0 # Node ID 22fdc00894aa2264c0a64886b4faafbff0db3f6d # Parent 8b225c2935e7536b1e1194fda2ff58782c2b2154 The tree that is created for evaluation of expression string at new map creation is deleted after usage. diff -r 8b225c2935e7 -r 22fdc00894aa gui/new_map_win.cc --- a/gui/new_map_win.cc Mon Jan 09 11:55:47 2006 +0000 +++ b/gui/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 8b225c2935e7 -r 22fdc00894aa gui/new_map_win.h --- a/gui/new_map_win.h Mon Jan 09 11:55:47 2006 +0000 +++ b/gui/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;