Ticket #23415: 23415-v2.patch
File 23415-v2.patch, 3.3 KB (added by , 5 months ago) |
---|
-
src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
146 146 private static void destroyInstance() { 147 147 MapFrame map = MainApplication.getMap(); 148 148 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(); 151 154 } 152 155 } 153 156 dialog = null; … … 180 183 this.layers.getModel().addChangeListener(l -> { 181 184 // We need to check to see whether or not the worker is shut down. See #22922 for details. 182 185 if (!MainApplication.worker.isShutdown() && this.isDialogShowing()) { 183 MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> { 184 Component selected = this.layers.getSelectedComponent(); 185 if (selected instanceof MoveImgDisplayPanel) { 186 ((MoveImgDisplayPanel<?>) selected).fireModelUpdate(); 187 } 188 })); 186 MainApplication.worker.execute(() -> GuiHelper.runInEDT(this::showNotify)); 189 187 } 190 188 }); 191 189 } … … 302 300 .filter(IGeoImageLayer.class::isInstance).map(IGeoImageLayer.class::cast).collect(Collectors.toList()); 303 301 if (geoImageLayers.isEmpty()) { 304 302 this.layers.setVisible(false); 303 hideNotify(); 304 if (hasInstance()) 305 destroyInstance(); 305 306 } else { 306 307 this.layers.setVisible(true); 307 308 if (changed) { … … 314 315 } else if (selected != null && !selected.layer.containsImage(this.currentEntry)) { 315 316 this.getImageTabs().filter(m -> m.layer.containsImage(this.currentEntry)).mapToInt(this.layers::indexOfComponent).findFirst() 316 317 .ifPresent(this.layers::setSelectedIndex); 318 } else if (selected == null) { 319 updateTitle(); 317 320 } 318 321 this.layers.invalidate(); 319 322 } … … 351 354 if (index >= 0) { 352 355 removeImageTab(((MoveImgDisplayPanel<?>) layers.getComponentAt(index)).layer); 353 356 getImageTabs().forEach(m -> m.setVisible(m.isVisible())); 357 showNotify(); 354 358 return; 355 359 } 356 360 source = source.getParent(); … … 416 420 imageRemoveAction.destroy(); 417 421 imageRemoveFromDiskAction.destroy(); 418 422 imageZoomAction.destroy(); 423 toggleAction.destroy(); 419 424 cancelLoadingImage(); 420 425 super.destroy(); 421 destroyInstance();422 426 } 423 427 424 428 /** … … 1065 1069 if (btnCollapse != null) { 1066 1070 btnCollapse.setVisible(!isDocked); 1067 1071 } 1068 this.updateLayers(true);1069 1072 } 1070 1073 1071 1074 /**