void (@NotNull Consumer<TerminalWidget> listener, @NotNull Disposable parentDisposable) { myTerminalSetupHandlers.add(listener); if (!Disposer.tryRegister(parentDisposable, () -> { myTerminalSetupHandlers.remove(listener); })) { myTerminalSetupHandlers.remove(listener); } }