mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
mem leaks: clear CWindow listeners and rootPane: NPE in recycled popups on Linux
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user