Changes between Initial Version and Version 1 of Ticket #20989


Ignore:
Timestamp:
2021-06-23T12:51:53+02:00 (5 years ago)
Author:
Bjoeni
Comment:
  • src/org/openstreetmap/josm/gui/layer/MainLayerManager.java

     
    299299            return new ArrayList<>();
    300300        }
    301301
    302         if (layer == activeLayer || layer == osmDataLayer) {
     302        if (!MainApplication.worker.isShutdown() && (layer == activeLayer || layer == osmDataLayer)) {
    303303            Layer nextActive = suggestNextActiveLayer(layer);
    304304            setActiveLayer(nextActive, true);
    305305        }
    306306
    307307        Collection<Layer> toDelete = super.realRemoveSingleLayer(layer);
    308         if (getLayers().isEmpty()) {
     308        if (!MainApplication.worker.isShutdown() && getLayers().isEmpty()) {
    309309            LayerAvailabilityEvent e = new LayerAvailabilityEvent(this, false);
    310310            for (LayerAvailabilityListener l : layerAvailabilityListeners) {
    311311                l.afterLastLayerRemoved(e);

The problem is that the LayerManager attempts to set a new active layer when another (currently active) layer is removed - even when exiting JOSM. This will cause issues, since the MainApplication.worker is already shutdown at that point. It could also be fixed by shutting down the worker after removing all layers, but I think it's anyways pointless to set a new active layer during shutdown. (The layerRemoving event required e.g. by the AutoSaveTask will still be fired.)

Also, turns out it's not related to #20871.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20989

    • Property Milestone21.06
    • Property Summary RejectedExecutionException when shutting down JOSM[Patch] RejectedExecutionException when shutting down JOSM
  • Ticket #20989 – Description

    initial v1  
    33I set the component to Core because I think the issue is not the GeoImageLayer trying to call the `MainApplication.worker`, but that the worker is already shutdown at this point. But I haven't debugged it any further yet.
    44
    5 Possibly somewhat related: #20871
     5~~Possibly somewhat related: #20871~~
    66
    77{{{