From: Eunki, Hong Date: Mon, 26 Feb 2024 10:27:03 +0000 (+0900) Subject: Fix memory leak issue when we convert pixelData X-Git-Tag: dali_2.3.13~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abcee93f0cabbd6be74cddd9727e8e65e9d6a698;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git 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 --- 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); } } }