void (@Nullable Window window) { if (window == null) return; SwingUtilities.invokeLater(() -> { for (WindowListener listener : window.getWindowListeners()) { if (listener.getClass().getName().startsWith("com.intellij.")) { //LOG.warn("Stale listener: " + listener); window.removeWindowListener(listener); } } }); }