Ticket #23415: 23415.patch
| File 23415.patch, 2.9 KB (added by , 2 years 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) { … … 351 352 if (index >= 0) { 352 353 removeImageTab(((MoveImgDisplayPanel<?>) layers.getComponentAt(index)).layer); 353 354 getImageTabs().forEach(m -> m.setVisible(m.isVisible())); 355 showNotify(); 354 356 return; 355 357 } 356 358 source = source.getParent(); … … 416 418 imageRemoveAction.destroy(); 417 419 imageRemoveFromDiskAction.destroy(); 418 420 imageZoomAction.destroy(); 421 toggleAction.destroy(); 419 422 cancelLoadingImage(); 420 423 super.destroy(); 421 destroyInstance();422 424 } 423 425 424 426 /** … … 1065 1067 if (btnCollapse != null) { 1066 1068 btnCollapse.setVisible(!isDocked); 1067 1069 } 1068 this.updateLayers(true);1069 1070 } 1070 1071 1071 1072 /**
