From 66221a32b985ff236287db860dc412d3c78427a3 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Tue, 19 Nov 2013 10:12:22 +0400 Subject: [PATCH] fixed memory leak in ogl::Texture2D --- modules/core/src/opengl_interop.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/core/src/opengl_interop.cpp b/modules/core/src/opengl_interop.cpp index 72d5ffebdf..bf368ead64 100644 --- a/modules/core/src/opengl_interop.cpp +++ b/modules/core/src/opengl_interop.cpp @@ -1022,6 +1022,7 @@ cv::ogl::Texture2D::Texture2D(InputArray arr, bool autoRelease) : rows_(0), cols #else GpuMat dmat = arr.getGpuMat(); ogl::Buffer buf(dmat, ogl::Buffer::PIXEL_UNPACK_BUFFER); + buf.setAutoRelease(true); buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER); impl_ = new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], 0, autoRelease); ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER); @@ -1135,6 +1136,7 @@ void cv::ogl::Texture2D::copyFrom(InputArray arr, bool autoRelease) #else GpuMat dmat = arr.getGpuMat(); ogl::Buffer buf(dmat, ogl::Buffer::PIXEL_UNPACK_BUFFER); + buf.setAutoRelease(true); buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER); impl_->copyFrom(asize.width, asize.height, srcFormats[cn], gl_types[depth], 0); ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER); @@ -1185,6 +1187,7 @@ void cv::ogl::Texture2D::copyTo(OutputArray arr, int ddepth, bool autoRelease) c throw_nocuda(); #else ogl::Buffer buf(rows_, cols_, CV_MAKE_TYPE(ddepth, cn), ogl::Buffer::PIXEL_PACK_BUFFER); + buf.setAutoRelease(true); buf.bind(ogl::Buffer::PIXEL_PACK_BUFFER); impl_->copyTo(dstFormat, gl_types[ddepth], 0); ogl::Buffer::unbind(ogl::Buffer::PIXEL_PACK_BUFFER);