diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f386bf..d62c1a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## 2.2.0-rc.2 - ImageKnife支持heic图片修改demo,按钮控制组件是否展示 - ImageKnife控制可视化区域图片 +- 修复占位图、错误图、重试图从内存获取之后进入子线程导致内存泄露 +- ImageKnifeComponent组件key属性改为id属性 ## 2.2.0-rc.1 - 修改ImageKnife跳过网络,点击默认,图片没有传入宽高,无显示bug diff --git a/library/src/main/ets/components/imageknife/ImageKnife.ets b/library/src/main/ets/components/imageknife/ImageKnife.ets index 040ab4d..3f91422 100644 --- a/library/src/main/ets/components/imageknife/ImageKnife.ets +++ b/library/src/main/ets/components/imageknife/ImageKnife.ets @@ -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; diff --git a/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets b/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets index caf12cf..a74608c 100644 --- a/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets +++ b/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets @@ -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)