Skip to content

Commit

Permalink
mem leaks: clear CWindow listeners and rootPane: drop glass/content p…
Browse files Browse the repository at this point in the history
…ane cleanup and see how it goes
  • Loading branch information
gregsh committed Dec 2, 2016
1 parent cc937d7 commit f8fe934
Showing 1 changed file with 7 additions and 10 deletions.
Expand Up @@ -949,8 +949,6 @@ protected void dispose() {

public static void cleanupRootPane(@Nullable JRootPane rootPane) {
if (rootPane == null) return;
rootPane.setContentPane(new JPanel());
rootPane.setGlassPane(new JPanel());
RepaintManager.currentManager(rootPane).removeInvalidComponent(rootPane);
unregisterKeyboardActions(rootPane);
Disposer.clearOwnFields(rootPane, field -> {
Expand Down Expand Up @@ -979,15 +977,14 @@ private static void unregisterKeyboardActions(@Nullable JRootPane rootPane) {

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


Expand Down

0 comments on commit f8fe934

Please sign in to comment.