From 7b535827706880241322e300f77a5be1012b727f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 8 Oct 2016 01:27:34 +0300 Subject: [PATCH] Fix memory leaks --- source/stereocombiner.cpp | 5 +++++ source/stereocombiner.h | 2 +- source/stereoview.cpp | 5 +++++ source/stereoview.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/stereocombiner.cpp b/source/stereocombiner.cpp index 34c13bd..dbbe815 100644 --- a/source/stereocombiner.cpp +++ b/source/stereocombiner.cpp @@ -37,6 +37,11 @@ StereoCombiner::StereoCombiner(): mirror(0) { } +StereoCombiner::~StereoCombiner() +{ + delete mirror; +} + void StereoCombiner::configure_eye_frustums(const Frustum &left_frustum, const Frustum &right_frustum) { float vertical = max(max(left_frustum.top, -left_frustum.bottom), max(right_frustum.top, -right_frustum.bottom)); diff --git a/source/stereocombiner.h b/source/stereocombiner.h index 88f979c..9dac08c 100644 --- a/source/stereocombiner.h +++ b/source/stereocombiner.h @@ -42,7 +42,7 @@ protected: StereoCombiner(); public: - virtual ~StereoCombiner() { } + virtual ~StereoCombiner(); protected: void configure_eye_frustums(const Frustum &, const Frustum &); diff --git a/source/stereoview.cpp b/source/stereoview.cpp index f08cd79..8684474 100644 --- a/source/stereoview.cpp +++ b/source/stereoview.cpp @@ -129,6 +129,11 @@ StereoView::Eye::Eye(): target(0) { } +StereoView::Eye::~Eye() +{ + delete target; +} + void StereoView::Eye::create_target(unsigned w, unsigned h) { delete target; diff --git a/source/stereoview.h b/source/stereoview.h index e31fa3d..75361ba 100644 --- a/source/stereoview.h +++ b/source/stereoview.h @@ -42,6 +42,7 @@ private: RenderTarget *target; Eye(); + ~Eye(); void create_target(unsigned, unsigned); void setup_frame(const GL::Camera &, float, const EyeParams &) const; -- 2.45.2