From abcee93f0cabbd6be74cddd9727e8e65e9d6a698 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Mon, 26 Feb 2024 19:27:03 +0900 Subject: [PATCH] Fix memory leak issue when we convert pixelData If we convert buffer CPU side, we might not release sourceBuffer memory. To avoid this kind of memory leak, let we change the logic of glTexImage2D. Change-Id: Ib1725c5ca8e6653dd1605311e4e021b09be2d387 Signed-off-by: Eunki, Hong --- dali/internal/graphics/gles-impl/egl-graphics-controller.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp index 1200699..a3eb62f 100644 --- a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp +++ b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp @@ -802,12 +802,14 @@ void EglGraphicsController::ProcessTextureUpdateQueue() auto sourceStride = info.srcStride; std::vector tempBuffer; + uint8_t* srcBuffer = sourceBuffer; + if(mGlAbstraction->TextureRequiresConverting(srcFormat, destFormat, isSubImage)) { // Convert RGB to RGBA if necessary. if(texture->TryConvertPixelData(sourceBuffer, info.srcFormat, createInfo.format, info.srcSize, info.srcStride, info.srcExtent2D.width, info.srcExtent2D.height, tempBuffer)) { - sourceBuffer = &tempBuffer[0]; + srcBuffer = &tempBuffer[0]; sourceStride = 0u; // Converted buffer compacted. make stride as 0. srcFormat = destFormat; srcType = GLES::GLTextureFormatType(createInfo.format).type; @@ -843,7 +845,7 @@ void EglGraphicsController::ProcessTextureUpdateQueue() 0, srcFormat, srcType, - sourceBuffer); + srcBuffer); } else { @@ -854,7 +856,7 @@ void EglGraphicsController::ProcessTextureUpdateQueue() info.srcExtent2D.height, 0, info.srcSize, - sourceBuffer); + srcBuffer); } } else @@ -869,7 +871,7 @@ void EglGraphicsController::ProcessTextureUpdateQueue() info.srcExtent2D.height, srcFormat, srcType, - sourceBuffer); + srcBuffer); } else { @@ -881,7 +883,7 @@ void EglGraphicsController::ProcessTextureUpdateQueue() info.srcExtent2D.height, srcFormat, info.srcSize, - sourceBuffer); + srcBuffer); } } } -- 2.7.4