Changeset 17458 in josm


Ignore:
Timestamp:
2021-01-13T15:26:08+01:00 (8 days ago)
Author:
GerdP
Message:

see #17184: Memory leaks

  • clear collection rememberMovements in OrthogonalizeAction when no edit layer exits
  • clear refs to layers which may disturb GC, maybe because of the complex cyclic deps
Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r17188 r17458  
    680680    @Override
    681681    protected void updateEnabledState() {
     682        if (MainApplication.getLayerManager().getEditLayer() == null)
     683            rememberMovements.clear();
    682684        updateEnabledStateOnCurrentSelection();
    683685    }
  • trunk/src/org/openstreetmap/josm/actions/relation/AbstractRelationAction.java

    r15476 r17458  
    1616import org.openstreetmap.josm.io.NetworkManager;
    1717import org.openstreetmap.josm.io.OnlineResource;
     18import org.openstreetmap.josm.tools.Destroyable;
    1819import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    1920import org.openstreetmap.josm.tools.Utils;
     
    2526 * @since 13957 (signature)
    2627 */
    27 public abstract class AbstractRelationAction extends AbstractAction implements IPrimitiveAction {
     28public abstract class AbstractRelationAction extends AbstractAction implements IPrimitiveAction, Destroyable {
    2829    /** relation collection */
    2930    protected transient Collection<IRelation<?>> relations = Collections.<IRelation<?>>emptySet();
     
    7273        putValue("help", helpId);
    7374    }
     75
     76    @Override
     77    public void destroy() {
     78        relations = null;
     79    }
    7480}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r17440 r17458  
    407407        ExpertToggleAction.removeExpertModeChangeListener(visibilityWidthListener);
    408408        layerManager.removeLayerChangeListener(visibilityWidthListener);
     409        activateLayerAction.destroy();
    409410        cycleLayerUpAction.destroy();
    410411        cycleLayerDownAction.destroy();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/layer/ActivateLayerAction.java

    r16913 r17458  
    2020import org.openstreetmap.josm.gui.util.MultikeyShortcutAction;
    2121import org.openstreetmap.josm.tools.CheckParameterUtil;
     22import org.openstreetmap.josm.tools.Destroyable;
    2223import org.openstreetmap.josm.tools.ImageProvider;
    2324import org.openstreetmap.josm.tools.Shortcut;
     
    2728 */
    2829public final class ActivateLayerAction extends AbstractAction
    29 implements IEnabledStateUpdating, ActiveLayerChangeListener, MultikeyShortcutAction {
     30implements IEnabledStateUpdating, ActiveLayerChangeListener, MultikeyShortcutAction, Destroyable {
    3031    private transient Layer layer;
    3132    private final transient Shortcut multikeyShortcut;
     
    129130    }
    130131
     132    @Override
     133    public void destroy() {
     134        layer = null;
     135    }
     136
    131137}
Note: See TracChangeset for help on using the changeset viewer.