Changeset 16395 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2020-05-10T08:12:49+02:00 (5 years ago)
Author:
GerdP
Message:

fix #18680: Listener was not registered before: LayerChangeAdapter

Location:
trunk/src/org/openstreetmap/josm/gui/history
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java

    r14463 r16395  
    66import java.awt.BorderLayout;
    77import java.awt.Dimension;
     8import java.util.Arrays;
    89
    910import javax.swing.JPanel;
     
    152153    @Override
    153154    public void destroy() {
    154         model.unlinkAsListener();
    155         for (Destroyable component : new Destroyable[] {
    156                 tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer}) {
    157             component.destroy();
     155        if (model != null) {
     156            model.unlinkAsListener();
     157            model = null;
    158158        }
     159        Arrays.asList(tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer).stream()
     160                .filter(Destroyable.class::isInstance).forEach(Destroyable::destroy);
     161        tagInfoViewer = null;
     162        nodeListViewer = null;
     163        relationMemberListViewer = null;
     164        coordinateInfoViewer = null;
    159165    }
    160166}
  • trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java

    r14676 r16395  
    255255        @Override
    256256        public void destroy() {
    257             if (changesetInfoAction != null)
     257            if (changesetInfoAction != null) {
    258258                changesetInfoAction.destroy();
    259             if (userInfoAction != null)
     259                changesetInfoAction = null;
     260            }
     261            if (userInfoAction != null) {
    260262                userInfoAction.destroy();
     263                userInfoAction = null;
     264            }
    261265        }
    262266    }
Note: See TracChangeset for help on using the changeset viewer.