gui/new_map_win.cc
changeset 1887 22fdc00894aa
parent 1884 9c061834b33b
child 1888 eed01ce27087
     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];