Skip to content

Commit 99f43c0

Browse files
committed
Merge pull request #7504 from lrineau/Polyhedron_demo-fix_memory_leaks-GF
fix various memory leaks in CGAL Lab
2 parents 432d66b + d1cda5b commit 99f43c0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Polyhedron/demo/Polyhedron/Point_container.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ Point_container::Point_container(int program, bool indexed)
2727

2828
}
2929

30+
Point_container::~Point_container()
31+
{
32+
delete d;
33+
}
34+
3035
void Point_container::initGL(Viewer_interface *viewer)
3136
{
3237
viewer->makeCurrent();
@@ -64,7 +69,6 @@ void Point_container::initGL(Viewer_interface *viewer)
6469
setVbo(Colors,
6570
new Vbo("colors",
6671
Vbo::COLORS));
67-
setVao(viewer, new Vao(viewer->getShaderProgram(getProgram())));
6872
if(viewer->getShaderProgram(getProgram())->property("hasNormals").toBool())
6973
{
7074
if(!getVbo(Normals))

Three/include/CGAL/Three/Point_container.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ struct DEMO_FRAMEWORK_EXPORT Point_container :public Primitive_container
5555
//!
5656
Point_container(int program, bool indexed);
5757

58+
~Point_container();
59+
5860
//!
5961
//! \brief initGL creates the `Vbo`s and `Vao`s of this `Point_container`.
6062
//! \attention It must be called within a valid OpenGL context. The `draw()` function of an item is always a safe place to call this.

Three/include/CGAL/Three/Primitive_container.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <CGAL/Three/Viewer_interface.h>
2020
#include <CGAL/Three/Scene_item_rendering_helper.h>
2121

22+
#include <memory> // for std::unique_ptr
23+
2224
using namespace CGAL::Three;
2325

2426
#ifdef demo_framework_EXPORTS
@@ -248,7 +250,7 @@ class DEMO_FRAMEWORK_EXPORT Primitive_container
248250
//!
249251
private:
250252
friend struct D;
251-
mutable D* d;
253+
std::unique_ptr<D> d;
252254
}; //end of class Triangle_container
253255

254256
}

0 commit comments

Comments
 (0)