Skip to content

Commit

Permalink
Fix #23362: Cannot close ImageViewerDialog when multiple image layers…
Browse files Browse the repository at this point in the history
… are available

git-svn-id: https://josm.openstreetmap.de/svn/trunk@18934 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
taylor.smock committed Jan 3, 2024
1 parent ff8711d commit a4dad1e
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private ImageViewerDialog() {
// model update, then the image will change instead of remaining the same.
this.layers.getModel().addChangeListener(l -> {
// We need to check to see whether or not the worker is shut down. See #22922 for details.
if (!MainApplication.worker.isShutdown()) {
if (!MainApplication.worker.isShutdown() && this.isDialogShowing()) {
MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> {
Component selected = this.layers.getSelectedComponent();
if (selected instanceof MoveImgDisplayPanel) {
Expand All @@ -190,6 +190,15 @@ private ImageViewerDialog() {
});
}

@Override
public void showNotify() {
super.showNotify();
Component selected = this.layers.getSelectedComponent();
if (selected instanceof MoveImgDisplayPanel) {
((MoveImgDisplayPanel<?>) selected).fireModelUpdate();
}
}

@Override
public void hideNotify() {
super.hideNotify();
Expand Down Expand Up @@ -929,7 +938,7 @@ public void displayImages(List<? extends IImageEntry<?>> entries) {
}
if (!isDialogShowing()) {
setIsDocked(false); // always open a detached window when an image is clicked and dialog is closed
showDialog();
unfurlDialog();
} else if (isDocked && isCollapsed) {
expand();
dialogsPanel.reconstruct(DialogsPanel.Action.COLLAPSED_TO_DEFAULT, this);
Expand Down

0 comments on commit a4dad1e

Please sign in to comment.