mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 23:59:22 -06:00
Fix race condition in pane container closing
Fixes COMPILER-EXPLORER-3W3: Prevents 'Can't remove child item' errors when attempting to close containers that have already been destroyed or removed from the layout hierarchy. Uses modern TypeScript optional chaining to check container validity before attempting close operations, preventing race conditions between compiler close events and GoldenLayout's own destruction process.
This commit is contained in:
@@ -227,7 +227,12 @@ export abstract class Pane<S> {
|
||||
/** Close the pane if the compiler this pane was attached to closes */
|
||||
protected onCompilerClose(compilerId: number) {
|
||||
if (this.compilerInfo.compilerId === compilerId) {
|
||||
_.defer(() => this.container.close());
|
||||
_.defer(() => {
|
||||
// Check if container is still valid before attempting to close
|
||||
if (this.container?.parent && this.container.layoutManager?.isInitialised) {
|
||||
this.container.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user