]> git.sesse.net Git - movit/commitdiff
More deallocation.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Oct 2012 20:18:07 +0000 (22:18 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Oct 2012 20:18:07 +0000 (22:18 +0200)
effect.h
flat_input.cpp
flat_input.h
test_util.cpp

index da4f74d0f4dee5b9c586e6798f24e612b27ba1e6..d0ed95b7665b4e36b864bee4ace5508e8f58d68f 100644 (file)
--- 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.
index 089008344c3f457468146203b84fbad5a638e527..31800a74a28c69dc7368d47e48c7ce77cfa1431a 100644 (file)
@@ -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.
index 39419b1954fe5125fdd43386ca360a691c3f25f4..a315735249dab4ea07ebca3997131db46d2101f0 100644 (file)
@@ -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"; }
 
index ab10f7b82be0fd3a4528d54eb406cdd6ce09f733..36c7d7c1e52995a2202c2e8dac2e98f81493eb10 100644 (file)
@@ -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)