mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
fix!: move destroy earlier in the lifcycle (#7117)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user