mem leaks: clear CWindow listeners and rootPane: NPE in recycled popups on Linux

This commit is contained in:
Gregory.Shrago
2016-12-02 17:21:03 +03:00
parent c6cf5d2315
commit 32c2b216c0
@@ -949,9 +949,15 @@ public abstract class DialogWrapper {
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 -> !field.getDeclaringClass().getName().startsWith("java.awt."));
Disposer.clearOwnFields(rootPane, field -> {
// keep AWT and Swing fields intact
String name = field.getDeclaringClass().getName();
return !(name.startsWith("java.") || name.startsWith("javax."));
});
}
private static void unregisterKeyboardActions(@Nullable JRootPane rootPane) {