Skip to content

Commit a4dad1e

Browse files
author
taylor.smock
committed
Fix #23362: Cannot close ImageViewerDialog when multiple image layers are available
git-svn-id: https://josm.openstreetmap.de/svn/trunk@18934 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent ff8711d commit a4dad1e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private ImageViewerDialog() {
179179
// model update, then the image will change instead of remaining the same.
180180
this.layers.getModel().addChangeListener(l -> {
181181
// We need to check to see whether or not the worker is shut down. See #22922 for details.
182-
if (!MainApplication.worker.isShutdown()) {
182+
if (!MainApplication.worker.isShutdown() && this.isDialogShowing()) {
183183
MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> {
184184
Component selected = this.layers.getSelectedComponent();
185185
if (selected instanceof MoveImgDisplayPanel) {
@@ -190,6 +190,15 @@ private ImageViewerDialog() {
190190
});
191191
}
192192

193+
@Override
194+
public void showNotify() {
195+
super.showNotify();
196+
Component selected = this.layers.getSelectedComponent();
197+
if (selected instanceof MoveImgDisplayPanel) {
198+
((MoveImgDisplayPanel<?>) selected).fireModelUpdate();
199+
}
200+
}
201+
193202
@Override
194203
public void hideNotify() {
195204
super.hideNotify();
@@ -929,7 +938,7 @@ public void displayImages(List<? extends IImageEntry<?>> entries) {
929938
}
930939
if (!isDialogShowing()) {
931940
setIsDocked(false); // always open a detached window when an image is clicked and dialog is closed
932-
showDialog();
941+
unfurlDialog();
933942
} else if (isDocked && isCollapsed) {
934943
expand();
935944
dialogsPanel.reconstruct(DialogsPanel.Action.COLLAPSED_TO_DEFAULT, this);

0 commit comments

Comments
 (0)