From 660552d9a5b332b39e5975ddba58f736a5c1979f Mon Sep 17 00:00:00 2001 From: "guzhu@fairygui.com" Date: Wed, 31 Jan 2024 16:48:30 +0800 Subject: [PATCH] fix: FillTextureCmd does not retain texture reference --- src/layaAir/laya/display/cmd/FillTextureCmd.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/layaAir/laya/display/cmd/FillTextureCmd.ts b/src/layaAir/laya/display/cmd/FillTextureCmd.ts index 57b51e255b..29f2fcec54 100644 --- a/src/layaAir/laya/display/cmd/FillTextureCmd.ts +++ b/src/layaAir/laya/display/cmd/FillTextureCmd.ts @@ -53,6 +53,7 @@ export class FillTextureCmd { static create(texture: Texture, x: number, y: number, width: number, height: number, type: string, offset: Point, color: string): FillTextureCmd { var cmd: FillTextureCmd = Pool.getItemByClass("FillTextureCmd", FillTextureCmd); cmd.texture = texture; + texture._addReference(); cmd.x = x; cmd.y = y; cmd.width = width; @@ -67,6 +68,7 @@ export class FillTextureCmd { * 回收到对象池 */ recover(): void { + this.texture && this.texture._removeReference(); this.texture = null; this.offset = null; Pool.recover("FillTextureCmd", this);