fix various memory leaks in CGAL Lab

This commit is contained in:
Laurent Rineau 2023-06-08 12:54:59 +02:00
parent 432d66b613
commit d1cda5bd31
3 changed files with 10 additions and 2 deletions

View File

@ -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();
@ -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))

View File

@ -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.

View File

@ -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
@ -248,7 +250,7 @@ public:
//!
private:
friend struct D;
mutable D* d;
std::unique_ptr<D> d;
}; //end of class Triangle_container
}