fix!: move destroy earlier in the lifcycle (#7117)

This commit is contained in:
Beka Westberg
2023-06-01 05:25:31 -07:00
committed by GitHub
parent 6bae8a4b92
commit 91be84ab7c
2 changed files with 35 additions and 17 deletions

View File

@@ -343,23 +343,17 @@ export class Block implements IASTNodeLocation, IDeletable {
this.workspace.removeChangeListener(this.onchangeWrapper_);
}
eventUtils.disable();
try {
this.workspace.removeTypedBlock(this);
this.workspace.removeBlockById(this.id);
this.disposing = true;
this.workspace.removeTypedBlock(this);
this.workspace.removeBlockById(this.id);
this.disposing = true;
this.childBlocks_.forEach((c) => c.disposeInternal());
this.inputList.forEach((i) => i.dispose());
this.inputList.length = 0;
this.getConnections_(true).forEach((c) => c.dispose());
} finally {
eventUtils.enable();
if (typeof this.destroy === 'function') {
this.destroy();
}
this.disposed = true;
}
if (typeof this.destroy === 'function') this.destroy();
this.childBlocks_.forEach((c) => c.disposeInternal());
this.inputList.forEach((i) => i.dispose());
this.inputList.length = 0;
this.getConnections_(true).forEach((c) => c.dispose());
this.disposed = true;
}
/**