fix memory leak

Signed-off-by: 周思远 <zhousiyuan8@huawei.com>
This commit is contained in:
周思远 2024-11-21 21:19:20 +08:00
parent a0cc051cf2
commit 61f211e569

View File

@ -49,7 +49,11 @@ RSImageBase::~RSImageBase()
#endif
pixelMap_ = nullptr;
if (uniqueId_ > 0) {
RSImageCache::Instance().CollectUniqueId(uniqueId_);
if (renderServiceImage_ || isDrawn_) {
RSImageCache::Instance().CollectUniqueId(uniqueId_);
} else {
RSImageCache::Instance().ReleasePixelMapCache(uniqueId_);
}
}
#if defined(ROSEN_OHOS) && defined(RS_ENABLE_VK)
if (RSSystemProperties::GetGpuApiType() == GpuApiType::VULKAN ||