From f898f4106a13b1efdbad85037781f785c2064a76 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 13 Oct 2012 22:18:07 +0200 Subject: [PATCH] More deallocation. --- effect.h | 2 ++ flat_input.cpp | 14 ++++++++++++++ flat_input.h | 1 + test_util.cpp | 2 ++ 4 files changed, 19 insertions(+) diff --git a/effect.h b/effect.h index da4f74d..d0ed95b 100644 --- a/effect.h +++ b/effect.h @@ -50,6 +50,8 @@ void set_uniform_mat3(GLuint glsl_program_num, const std::string &prefix, const class Effect { public: + virtual ~Effect() {} + // An identifier for this type of effect, mostly used for debug output // (but some special names, like "ColorSpaceConversionEffect", holds special // meaning). Same as the class name is fine. diff --git a/flat_input.cpp b/flat_input.cpp index 0890083..31800a7 100644 --- a/flat_input.cpp +++ b/flat_input.cpp @@ -9,6 +9,8 @@ FlatInput::FlatInput(ImageFormat image_format, MovitPixelFormat pixel_format, GL : image_format(image_format), pixel_format(pixel_format), type(type), + pbo(0), + texture_num(0), needs_update(false), finalized(false), output_linear_gamma(false), @@ -22,6 +24,18 @@ FlatInput::FlatInput(ImageFormat image_format, MovitPixelFormat pixel_format, GL register_int("needs_mipmaps", &needs_mipmaps); } +FlatInput::~FlatInput() +{ + if (pbo != 0) { + glDeleteBuffers(1, &pbo); + check_error(); + } + if (texture_num != 0) { + glDeleteTextures(1, &texture_num); + check_error(); + } +} + void FlatInput::finalize() { // Translate the input format to OpenGL's enums. diff --git a/flat_input.h b/flat_input.h index 39419b1..a315735 100644 --- a/flat_input.h +++ b/flat_input.h @@ -8,6 +8,7 @@ class FlatInput : public Input { public: FlatInput(ImageFormat format, MovitPixelFormat pixel_format, GLenum type, unsigned width, unsigned height); + ~FlatInput(); virtual std::string effect_type_id() const { return "FlatInput"; } diff --git a/test_util.cpp b/test_util.cpp index ab10f7b..36c7d7c 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -37,7 +37,9 @@ EffectChainTester::EffectChainTester(const float *data, unsigned width, unsigned EffectChainTester::~EffectChainTester() { glDeleteFramebuffers(1, &fbo); + check_error(); glDeleteTextures(1, &texnum); + check_error(); } Input *EffectChainTester::add_input(const float *data, MovitPixelFormat pixel_format, ColorSpace color_space, GammaCurve gamma_curve) -- 2.39.2