From: Steinar H. Gunderson Date: Sat, 13 Oct 2012 20:26:22 +0000 (+0200) Subject: Deallocation in YCbCrInput. X-Git-Tag: 1.0~258 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=0de0202b22a6349d0f9c838947a96eef8155ac90 Deallocation in YCbCrInput. --- diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index a73518d..268abcb 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -17,6 +17,9 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format, width(width), height(height) { + pbos[0] = pbos[1] = pbos[2] = 0; + texture_num[0] = texture_num[1] = texture_num[2] = 0; + pitch[0] = pitch[1] = pitch[2] = width; assert(width % ycbcr_format.chroma_subsampling_x == 0); @@ -32,6 +35,18 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format, register_int("needs_mipmaps", &needs_mipmaps); } +YCbCrInput::~YCbCrInput() +{ + if (pbos[0] != 0) { + glDeleteBuffers(3, pbos); + check_error(); + } + if (texture_num[0] != 0) { + glDeleteTextures(3, texture_num); + check_error(); + } +} + void YCbCrInput::finalize() { // Create PBOs to hold the textures holding the input image, and then the texture itself. diff --git a/ycbcr_input.h b/ycbcr_input.h index ed0c6ee..76afc3a 100644 --- a/ycbcr_input.h +++ b/ycbcr_input.h @@ -30,6 +30,7 @@ public: YCbCrInput(const ImageFormat &image_format, const YCbCrFormat &ycbcr_format, unsigned width, unsigned height); + ~YCbCrInput(); virtual std::string effect_type_id() const { return "YCbCrInput"; }