Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/core/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export class Layout {
/** The target PixiJS container */
public readonly target: Container;

/**
* Whether this object has been destroyed. If true, the object should no longer be used.
* After an object is destroyed, all of its functionality is disabled and references are removed.
*/
public destroyed = false;

/**
* Flag indicating if layout needs recalculation
* @ignore
Expand Down Expand Up @@ -278,6 +284,9 @@ export class Layout {
}

public destroy(): void {
if (this.destroyed) return;
this.destroyed = true;

this.invalidateRoot();
this.yoga.free();
this.target.off('added', this._onChildAdded, this);
Expand Down
Loading