mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(ios): UIImage memory leaking after Image is disposed (#9777)
This commit is contained in:

committed by
Nathan Walker

parent
47d45463a8
commit
19d8869f1d
@ -24,6 +24,21 @@ export class Image extends ImageBase {
|
||||
this._setNativeClipToBounds();
|
||||
}
|
||||
|
||||
public disposeNativeView(): void {
|
||||
super.disposeNativeView();
|
||||
|
||||
if (this.imageSource?.ios) {
|
||||
// release the native UIImage
|
||||
CFRelease(this.imageSource.ios);
|
||||
}
|
||||
|
||||
this.imageSource = null;
|
||||
|
||||
if (this.nativeViewProtected?.image) {
|
||||
this.nativeViewProtected.image = null;
|
||||
}
|
||||
}
|
||||
|
||||
private setTintColor(value: Color) {
|
||||
if (value && this.nativeViewProtected.image && !this._templateImageWasCreated) {
|
||||
this.nativeViewProtected.image = this.nativeViewProtected.image.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
|
||||
|
Reference in New Issue
Block a user