Skip to content

Commit

Permalink
fix: FillTextureCmd does not retain texture reference
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoguzhu committed Jan 31, 2024
1 parent 96ab0d0 commit 660552d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/layaAir/laya/display/cmd/FillTextureCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -67,6 +68,7 @@ export class FillTextureCmd {
* 回收到对象池
*/
recover(): void {
this.texture && this.texture._removeReference();
this.texture = null;
this.offset = null;
Pool.recover("FillTextureCmd", this);
Expand Down

0 comments on commit 660552d

Please sign in to comment.