修复占位图、错误图、重试图从内存获取之后进入子线程导致内存泄露

Signed-off-by: zgf <zenggaofeng2@h-partners.com>
This commit is contained in:
zgf 2024-05-04 17:09:21 +08:00
parent 4ee4760aed
commit a6bbe8341a
3 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,8 @@
## 2.2.0-rc.2
- ImageKnife支持heic图片修改demo按钮控制组件是否展示
- ImageKnife控制可视化区域图片
- 修复占位图、错误图、重试图从内存获取之后进入子线程导致内存泄露
- ImageKnifeComponent组件key属性改为id属性
## 2.2.0-rc.1
- 修改ImageKnife跳过网络,点击默认,图片没有传入宽高,无显示bug

View File

@ -612,15 +612,15 @@ export class ImageKnife {
let retryholderCache = this.memoryCacheProxy.loadMemoryCache(request.retryholderCacheKey, request.isCacheable);
let errorholderCacheKey = this.memoryCacheProxy.loadMemoryCache(request.errorholderCacheKey, request.isCacheable);
if (usageType == Constants.PLACE_HOLDER && placeholderCache && !mainCache && !retryholderCache && !errorholderCacheKey) {
if (usageType == Constants.PLACE_HOLDER && placeholderCache) {
LogUtil.info("imageknife load placeholder from MemoryCache")
request.placeholderOnComplete(placeholderCache);
return;
} else if (usageType == Constants.RETRY_HOLDER && retryholderCache && !mainCache && !errorholderCacheKey) {
} else if (usageType == Constants.RETRY_HOLDER && retryholderCache) {
LogUtil.info("imageknife load retryholder from MemoryCache")
request.retryholderOnComplete(retryholderCache);
return;
} else if (usageType == Constants.ERROR_HOLDER && errorholderCacheKey && !mainCache) {
} else if (usageType == Constants.ERROR_HOLDER && errorholderCacheKey) {
LogUtil.info("imageknife load errorholder from MemoryCache")
request.errorholderOnComplete(errorholderCacheKey);
return;

View File

@ -119,7 +119,7 @@ export struct ImageKnifeComponent {
build() {
Canvas(this.context)
.key(this.keyCanvas.keyId)
.id(this.keyCanvas.keyId)
.width((this.imageKnifeOption!=undefined && this.imageKnifeOption.mainScaleType!= undefined && this.imageKnifeOption.mainScaleType == ScaleType.AUTO_WIDTH )? this.currentSize.width:'100%')
.height((this.imageKnifeOption!=undefined && this.imageKnifeOption.mainScaleType!= undefined && this.imageKnifeOption.mainScaleType == ScaleType.AUTO_HEIGHT )? this.currentSize.height:'100%')
.renderFit(RenderFit.RESIZE_FILL)