Ticket #23419: 23419.patch

File 23419.patch, 1.3 KB (added by GerdP, 2 years ago)

make sure to cleanup collections

  • src/org/openstreetmap/josm/actions/SessionSaveAction.java

     
    155155     * @throws UserCancelException when the user has cancelled the save process
    156156     */
    157157    public boolean saveSession(boolean saveAs, boolean forceSaveAll) throws UserCancelException {
     158        try {
     159            return saveSessionImpl(saveAs, forceSaveAll);
     160        } finally {
     161            cleanup();
     162        }
     163    }
     164
     165    private boolean saveSessionImpl(boolean saveAs, boolean forceSaveAll) throws UserCancelException {
    158166        if (!isEnabled()) {
    159167            return false;
    160168        }
     
    368376        }
    369377
    370378        /**
    371          * Initializes action.
     379         * Initializes some action fields.
    372380         */
    373         public final void initialize() {
     381        private void initialize() {
    374382            layers = new ArrayList<>(getLayerManager().getLayers());
    375383            exporters = new HashMap<>();
    376384            dependencies = new MultiMap<>();
     
    612620        return false;
    613621    }
    614622
     623    protected void cleanup() {
     624        layers = null;
     625        exporters = null;
     626        dependencies = null;
     627    }
     628
    615629}