Changeset 3351 in josm for trunk/src


Ignore:
Timestamp:
2010-06-28T08:03:42+02:00 (14 years ago)
Author:
jttt
Message:

Fixed #5173 memory leak in search dialog - almost every ExtendedDialog wasn't disposed after close - changed to dispose dialogs automatically

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

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

    r3338 r3351  
    3030
    3131public class ExtendedDialog extends JDialog {
     32    private final boolean disposeOnClose;
    3233    private int result = 0;
    3334    public static final int DialogClosedOtherwise = 0;
     
    8586     */
    8687    public ExtendedDialog(Component parent, String title, String[] buttonTexts) {
    87         super(JOptionPane.getFrameForComponent(parent), title, true);
    88         this.parent = parent;
    89         bTexts = buttonTexts;
     88        this(parent, title, buttonTexts, true, true);
    9089    }
    9190
     
    9594    public ExtendedDialog(Component parent, String title, String[] buttonTexts,
    9695            boolean modal) {
     96        this(parent, title, buttonTexts, modal, true);
     97    }
     98
     99    public ExtendedDialog(Component parent, String title, String[] buttonTexts,
     100            boolean modal, boolean disposeOnClose) {
    97101        super(JOptionPane.getFrameForComponent(parent), title, modal);
    98102        this.parent = parent;
    99103        bTexts = buttonTexts;
     104        if (disposeOnClose) {
     105            setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
     106        }
     107        this.disposeOnClose = disposeOnClose;
    100108    }
    101109
     
    342350        }
    343351        super.setVisible(visible);
     352
     353        if (!visible && disposeOnClose) {
     354            dispose();
     355        }
    344356    }
    345357
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r3083 r3351  
    119119                "",
    120120                new String[] { tr("Apply Changes"), tr("Cancel")},
     121                false,
    121122                false
    122123        );
  • trunk/src/org/openstreetmap/josm/gui/widgets/ComboBoxHistory.java

    r3215 r3351  
    2929
    3030import java.util.ArrayList;
    31 import java.util.Collections;
    3231import java.util.Iterator;
    3332import java.util.List;
     
    3534import javax.swing.DefaultComboBoxModel;
    3635
    37 import org.openstreetmap.josm.gui.tagging.ac.*;
     36import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;
    3837
    3938public class ComboBoxHistory extends DefaultComboBoxModel implements Iterable<AutoCompletionListItem> {
Note: See TracChangeset for help on using the changeset viewer.