The tree that is created for evaluation of expression string at new map creation is deleted after usage.
authorhegyi
Mon, 09 Jan 2006 12:41:06 +0000
changeset 188722fdc00894aa
parent 1886 8b225c2935e7
child 1888 eed01ce27087
The tree that is created for evaluation of expression string at new map creation is deleted after usage.
gui/new_map_win.cc
gui/new_map_win.h
     1.1 --- a/gui/new_map_win.cc	Mon Jan 09 11:55:47 2006 +0000
     1.2 +++ b/gui/new_map_win.cc	Mon Jan 09 12:41:06 2006 +0000
     1.3 @@ -159,8 +159,6 @@
     1.4  
     1.5  	      //display it
     1.6  	      //gdc.changeEdgeText(mapname);
     1.7 -
     1.8 -	      //delete emptr;
     1.9  	    }
    1.10  	  else //!edge.get_active()
    1.11  	    {
    1.12 @@ -240,8 +238,6 @@
    1.13  
    1.14  	      //display it
    1.15  	      //gdc.changeNodeText(mapname);
    1.16 -
    1.17 -	      //delete emptr;
    1.18  	    }
    1.19  	  if(!abortion)
    1.20  	    {
    1.21 @@ -374,11 +370,26 @@
    1.22  
    1.23        std::string polishform=postOrder(root);
    1.24  
    1.25 +      deleteTree(root);
    1.26 +
    1.27        return polishform;
    1.28      }
    1.29    return "";
    1.30  }
    1.31  
    1.32 +void NewMapWin::deleteTree(NewMapWin::tree_node * node)
    1.33 +{
    1.34 +  if(node->left_child!=NULL)
    1.35 +    {
    1.36 +      deleteTree(node->left_child);
    1.37 +    }
    1.38 +  if(node->right_child!=NULL)
    1.39 +    {
    1.40 +      deleteTree(node->right_child);
    1.41 +    }
    1.42 +  delete node;
    1.43 +}
    1.44 +
    1.45  NewMapWin::tree_node * NewMapWin::weightedString2Tree(std::string to_tree, std::vector<unsigned int> & p, int offset)
    1.46  {
    1.47    unsigned int min=p[offset];
     2.1 --- a/gui/new_map_win.h	Mon Jan 09 11:55:47 2006 +0000
     2.2 +++ b/gui/new_map_win.h	Mon Jan 09 12:41:06 2006 +0000
     2.3 @@ -28,7 +28,7 @@
     2.4    
     2.5    ///Constructor of NewMapWin creates the widgets shown in NewMapWin.
     2.6    NewMapWin(const std::string& title, NoteBookTab &, bool itisedge=true, bool edgenode=true);
     2.7 -  
     2.8 +
     2.9    ///Signal on button is connected to this function,
    2.10    ///Therefore this function determines whether to
    2.11    ///call the map/creatort function, and if yes, it
    2.12 @@ -47,6 +47,8 @@
    2.13  
    2.14    bool validVariable(std::string, bool);
    2.15  
    2.16 +  void deleteTree(tree_node *);
    2.17 +
    2.18    std::map<char, std::string> ch2var;
    2.19  
    2.20    Gtk::Entry name, default_value;