remove memory leaks for duplicate points

This commit is contained in:
Eli Packer 2002-03-02 18:25:51 +00:00
parent b7ac96c3c6
commit 7cc0146809
1 changed files with 20 additions and 2 deletions

View File

@ -423,12 +423,21 @@ Largest_empty_iso_rectangle_2<T>::insert(const Point& _p)
_p.y() <= bl_p.y() || _p.y() >= tr_p.y())
return(false);
// check that the point is not already inserted
Point_data *po = new Point_data(_p);
Point_data_set_of_x::iterator iter = x_sorted.find(po);
if(iter != x_sorted.end()) {
delete(po);
return(true);
}
cache_valid = false;
Point_data_set_of_y *right_tent =
new Point_data_set_of_y(Less_yx(geom_traits()));
Point_data_set_of_y *left_tent =
new Point_data_set_of_y(Less_yx(geom_traits()));
Point_data *po = new Point_data(_p,right_tent,left_tent,REG);
po = new Point_data(_p,right_tent,left_tent,REG);
x_sorted.insert(po);
y_sorted.insert(po);
@ -555,12 +564,21 @@ Largest_empty_iso_rectangle_2<T>::insert(const Point& _p,
_p.y() <= bl_p.y() || _p.y() >= tr_p.y()))
return(false);
// check that the point is not already inserted
Point_data *po = new Point_data(_p);
Point_data_set_of_x::iterator iter = x_sorted.find(po);
if(iter != x_sorted.end()) {
delete(po);
return(true);
}
cache_valid = false;
Point_data_set_of_y *right_tent =
new Point_data_set_of_y(Less_yx(geom_traits()));
Point_data_set_of_y *left_tent =
new Point_data_set_of_y(Less_yx(geom_traits()));
Point_data *po = new Point_data(_p,right_tent,left_tent,i_type);
po = new Point_data(_p,right_tent,left_tent,i_type);
x_sorted.insert(po);
y_sorted.insert(po);