Skip to content

Commit

Permalink
Merge pull request #7504 from lrineau/Polyhedron_demo-fix_memory_leak…
Browse files Browse the repository at this point in the history
…s-GF

fix various memory leaks in CGAL Lab
  • Loading branch information
lrineau committed Jun 9, 2023
2 parents 432d66b + d1cda5b commit 99f43c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Polyhedron/demo/Polyhedron/Point_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Point_container::Point_container(int program, bool indexed)

}

Point_container::~Point_container()
{
delete d;
}

void Point_container::initGL(Viewer_interface *viewer)
{
viewer->makeCurrent();
Expand Down Expand Up @@ -64,7 +69,6 @@ void Point_container::initGL(Viewer_interface *viewer)
setVbo(Colors,
new Vbo("colors",
Vbo::COLORS));
setVao(viewer, new Vao(viewer->getShaderProgram(getProgram())));
if(viewer->getShaderProgram(getProgram())->property("hasNormals").toBool())
{
if(!getVbo(Normals))
Expand Down
2 changes: 2 additions & 0 deletions Three/include/CGAL/Three/Point_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ struct DEMO_FRAMEWORK_EXPORT Point_container :public Primitive_container
//!
Point_container(int program, bool indexed);

~Point_container();

//!
//! \brief initGL creates the `Vbo`s and `Vao`s of this `Point_container`.
//! \attention It must be called within a valid OpenGL context. The `draw()` function of an item is always a safe place to call this.
Expand Down
4 changes: 3 additions & 1 deletion Three/include/CGAL/Three/Primitive_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <CGAL/Three/Viewer_interface.h>
#include <CGAL/Three/Scene_item_rendering_helper.h>

#include <memory> // for std::unique_ptr

using namespace CGAL::Three;

#ifdef demo_framework_EXPORTS
Expand Down Expand Up @@ -248,7 +250,7 @@ class DEMO_FRAMEWORK_EXPORT Primitive_container
//!
private:
friend struct D;
mutable D* d;
std::unique_ptr<D> d;
}; //end of class Triangle_container

}
Expand Down

0 comments on commit 99f43c0

Please sign in to comment.