This commit is contained in:
Maxime Gimeno 2017-03-24 12:03:37 +01:00
parent a732bb3c66
commit f0424b49bd
10 changed files with 32 additions and 30 deletions

View File

@ -280,9 +280,6 @@ struct Scene_c3t3_item_priv {
invalidate_stats();
}
~Scene_c3t3_item_priv()
{
}
void destroy()
{
c3t3.clear();
tree.clear();
@ -294,6 +291,7 @@ struct Scene_c3t3_item_priv {
delete tet_Slider;
}
}
void init_default_values() {
positions_lines.resize(0);
positions_poly.resize(0);
@ -531,7 +529,6 @@ Scene_c3t3_item::~Scene_c3t3_item()
{
if(d)
{
d->destroy();
delete d;
d = NULL;
}
@ -2018,9 +2015,17 @@ void Scene_c3t3_item::itemAboutToBeDestroyed(Scene_item *item)
{
Scene_item::itemAboutToBeDestroyed(item);
if(d)
if(d && item == this)
{
d->destroy();
d->c3t3.clear();
d->tree.clear();
if(d->frame)
{
static_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first())->setManipulatedFrame(0);
delete d->frame;
d->frame = NULL;
delete d->tet_Slider;
}
delete d;
d=0;
}

View File

@ -149,7 +149,7 @@ public:
QColor get_histogram_color(const double v) const;
void itemAboutToBeDestroyed(Scene_item *);
void itemAboutToBeDestroyed(Scene_item *) Q_DECL_OVERRIDE;
protected:
friend struct Scene_c3t3_item_priv;

View File

@ -877,7 +877,7 @@ int Scene_points_with_normal_item::getPointSliderValue()
void Scene_points_with_normal_item::itemAboutToBeDestroyed(Scene_item *item)
{
Scene_item::itemAboutToBeDestroyed(item);
if(d && d->m_points)
if(d && d->m_points && item == this)
{
delete d->m_points;
d->m_points = NULL;

View File

@ -89,7 +89,7 @@ public Q_SLOTS:
void pointSliderPressed();
//Set the status of the slider as `released`
void pointSliderReleased();
void itemAboutToBeDestroyed(Scene_item *);
void itemAboutToBeDestroyed(Scene_item *) Q_DECL_OVERRIDE;
// Data
protected:

View File

@ -854,13 +854,12 @@ std::vector<CGAL::Color> Scene_polygon_soup_item::getFColors() const{return d->s
void Scene_polygon_soup_item::itemAboutToBeDestroyed(Scene_item *item)
{
Scene_item::itemAboutToBeDestroyed(item);
if(d)
{
if(d->soup)
{
delete d->soup;
d->soup=NULL;
}
}
if(d && item == this)
{
if(d->soup)
{
delete d->soup;
d->soup=NULL;
}
}
}

View File

@ -151,7 +151,7 @@ public Q_SLOTS:
void setDisplayNonManifoldEdges(const bool);
bool displayNonManifoldEdges() const;
void itemAboutToBeDestroyed(Scene_item *item);
void itemAboutToBeDestroyed(Scene_item *item) Q_DECL_OVERRIDE;
protected:
friend struct Scene_polygon_soup_item_priv;

View File

@ -94,6 +94,11 @@ struct Scene_polyhedron_item_priv{
{
init_default_values();
}
~Scene_polyhedron_item_priv()
{
delete poly;
delete targeted_id;
}
void init_default_values() {
show_only_feature_edges_m = false;
@ -123,11 +128,6 @@ struct Scene_polyhedron_item_priv{
const bool colors_only) const;
void init();
void invalidate_stats();
void destroy()
{
delete poly;
delete targeted_id;
}
void* get_aabb_tree();
QList<Kernel::Triangle_3> triangulate_primitive(Polyhedron::Facet_iterator fit,
Traits::Vector_3 normal);
@ -823,7 +823,6 @@ Scene_polyhedron_item::~Scene_polyhedron_item()
}
if(d)
{
d->destroy();
delete d;
d=NULL;
}
@ -1848,9 +1847,8 @@ void Scene_polyhedron_item::set_flat_disabled(bool b)
void Scene_polyhedron_item::itemAboutToBeDestroyed(Scene_item *item)
{
Scene_item::itemAboutToBeDestroyed(item);
if(d)
if(d && item == this)
{
d->destroy();
delete d;
d=NULL;
}

View File

@ -142,7 +142,7 @@ public Q_SLOTS:
void update_facet_indices();
void update_halfedge_indices();
void invalidate_aabb_tree();
void itemAboutToBeDestroyed(Scene_item *);
void itemAboutToBeDestroyed(Scene_item *) Q_DECL_OVERRIDE;
Q_SIGNALS:
void selection_done();

View File

@ -646,7 +646,7 @@ void Scene_surface_mesh_item::compute_bbox()const
void Scene_surface_mesh_item::itemAboutToBeDestroyed(Scene_item *item)
{
Scene_item::itemAboutToBeDestroyed(item);
if(d && d->smesh_)
if(d && d->smesh_ && item == this)
{
delete d->smesh_;
d->smesh_ = NULL;

View File

@ -53,7 +53,7 @@ public:
const SMesh* polyhedron() const;
void compute_bbox()const;
public Q_SLOTS:
void itemAboutToBeDestroyed(Scene_item *);
void itemAboutToBeDestroyed(Scene_item *) Q_DECL_OVERRIDE;
virtual void selection_changed(bool);
protected:
friend struct Scene_surface_mesh_item_priv;