Changeset 14601 in josm


Ignore:
Timestamp:
2018-12-25T21:17:28+01:00 (3 months ago)
Author:
GerdP
Message:

see #17040 dispose PreferenceDialog and call removeWindowListener()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

    r14106 r14601  
    4343    private final PreferenceTabbedPane tpPreferences = new PreferenceTabbedPane();
    4444    private final ContextSensitiveHelpAction helpAction = new ContextSensitiveHelpAction();
     45    private final WindowEventHandler windowEventHandler = new WindowEventHandler();
    4546    private boolean canceled;
    4647
     
    8485        tpPreferences.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    8586        c.add(buildActionPanel(), BorderLayout.SOUTH);
    86 
    87         addWindowListener(new WindowEventHandler());
     87        addWindowListener(windowEventHandler);
    8888
    8989        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
     
    177177        public void cancel() {
    178178            setCanceled(true);
    179             setVisible(false);
    180             tpPreferences.validationListeners.clear();
     179            dispose();
    181180        }
    182181
     
    202201
    203202            tpPreferences.savePreferences();
    204             tpPreferences.validationListeners.clear();
    205203            setCanceled(false);
    206             setVisible(false);
     204            dispose();
    207205        }
    208206    }
     
    214212        }
    215213    }
     214
     215    @Override
     216    public void dispose() {
     217        removeWindowListener(windowEventHandler);
     218        super.dispose();
     219    }
    216220}
Note: See TracChangeset for help on using the changeset viewer.