mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 11:39:49 -06:00
Remove 1500+ memory leaks in OpenSpace and Ghoul
This commit is contained in:
@@ -148,12 +148,13 @@ bool RenderableModel::deinitialize() {
|
||||
if (_geometry) {
|
||||
_geometry->deinitialize();
|
||||
delete _geometry;
|
||||
_geometry = nullptr;
|
||||
}
|
||||
if (_texture)
|
||||
delete _texture;
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
|
||||
_geometry = nullptr;
|
||||
_texture = nullptr;
|
||||
delete _programObject;
|
||||
_programObject = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,14 @@ bool RenderablePath::initialize() {
|
||||
|
||||
bool RenderablePath::deinitialize() {
|
||||
glDeleteVertexArrays(1, &_vaoID);
|
||||
_vaoID = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vBufferID);
|
||||
_vBufferID = 0;
|
||||
|
||||
delete _programObject;
|
||||
_programObject = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
|
||||
RenderablePlane::~RenderablePlane() {
|
||||
delete _textureFile;
|
||||
_textureFile = nullptr;
|
||||
}
|
||||
|
||||
bool RenderablePlane::isReady() const {
|
||||
@@ -142,9 +143,19 @@ bool RenderablePlane::initialize() {
|
||||
bool RenderablePlane::deinitialize() {
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vertexPositionBuffer);
|
||||
_vertexPositionBuffer = 0;
|
||||
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
|
||||
delete _textureFile;
|
||||
_textureFile = nullptr;
|
||||
|
||||
delete _shader;
|
||||
_shader = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class RenderablePlane : public Renderable {
|
||||
|
||||
public:
|
||||
RenderablePlane(const ghoul::Dictionary& dictionary);
|
||||
~RenderablePlane();
|
||||
~RenderablePlane();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
@@ -106,9 +106,6 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
_texturePath.onChange(std::bind(&RenderableSphere::loadTexture, this));
|
||||
}
|
||||
|
||||
RenderableSphere::~RenderableSphere() {
|
||||
}
|
||||
|
||||
bool RenderableSphere::isReady() const {
|
||||
return (_sphere != nullptr) && (_shader != nullptr) && (_texture != nullptr);
|
||||
}
|
||||
@@ -132,7 +129,14 @@ bool RenderableSphere::initialize() {
|
||||
|
||||
bool RenderableSphere::deinitialize() {
|
||||
delete _sphere;
|
||||
_sphere = nullptr;
|
||||
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
|
||||
delete _shader;
|
||||
_shader = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ class PowerScaledSphere;
|
||||
class RenderableSphere : public Renderable {
|
||||
public:
|
||||
RenderableSphere(const ghoul::Dictionary& dictionary);
|
||||
~RenderableSphere();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
@@ -137,6 +137,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
|
||||
RenderableStars::~RenderableStars() {
|
||||
delete _psfTextureFile;
|
||||
delete _colorTextureFile;
|
||||
delete _colorTexture;
|
||||
}
|
||||
|
||||
bool RenderableStars::isReady() const {
|
||||
|
||||
@@ -100,6 +100,10 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
_distanceFade = 1.0;
|
||||
}
|
||||
|
||||
RenderableTrail::~RenderableTrail() {
|
||||
delete _programObject;
|
||||
}
|
||||
|
||||
bool RenderableTrail::initialize() {
|
||||
if (!_successfullDictionaryFetch) {
|
||||
LERROR("The following keys need to be set in the Dictionary. Cannot initialize!");
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace openspace {
|
||||
class RenderableTrail : public Renderable {
|
||||
public:
|
||||
RenderableTrail(const ghoul::Dictionary& dictionary);
|
||||
~RenderableTrail();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
Reference in New Issue
Block a user