Skip to content

Commit

Permalink
Merge pull request #1333 from xiaoguzhu/LayaAir_3.1
Browse files Browse the repository at this point in the history
fix: FillTextureCmd does not retain texture reference
  • Loading branch information
xiaoguzhu authored Jan 31, 2024
2 parents 20411fb + 660552d commit 891a2dc
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 891a2dc

Please sign in to comment.