Ticket #23414: 23414.patch

File 23414.patch, 1.6 KB (added by GerdP, 14 months ago)

work in progress

  • src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java

     
    146146    private static void destroyInstance() {
    147147        MapFrame map = MainApplication.getMap();
    148148        synchronized (ImageViewerDialog.class) {
    149             if (dialog != null && map != null && map.getToggleDialog(ImageViewerDialog.class) != null) {
    150                 map.removeToggleDialog(dialog);
     149            if (dialog != null) {
     150                if (map != null && map.getToggleDialog(ImageViewerDialog.class) != null) {
     151                    map.removeToggleDialog(dialog);
     152                }
     153                dialog.destroy();
    151154            }
    152155        }
    153156        dialog = null;
     
    302305                .filter(IGeoImageLayer.class::isInstance).map(IGeoImageLayer.class::cast).collect(Collectors.toList());
    303306        if (geoImageLayers.isEmpty()) {
    304307            this.layers.setVisible(false);
     308            hideNotify();
     309            if (hasInstance())
     310                destroyInstance();
    305311        } else {
    306312            this.layers.setVisible(true);
    307313            if (changed) {
     
    416422        imageRemoveAction.destroy();
    417423        imageRemoveFromDiskAction.destroy();
    418424        imageZoomAction.destroy();
     425        toggleAction.destroy();
    419426        cancelLoadingImage();
    420427        super.destroy();
    421         destroyInstance();
    422428    }
    423429
    424430    /**