Changeset 12025 in josm


Ignore:
Timestamp:
2017-04-29T22:04:53+02:00 (21 months ago)
Author:
michael2402
Message:

See #14120: Throw a nicer exception if a layer is destroyed twice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/Layer.java

    r11848 r12025  
    151151
    152152    private final ValueChangeListener<Object> invalidateListener = change -> invalidate();
     153    private boolean isDestroyed;
    153154
    154155    /**
     
    271272     */
    272273    @Override
    273     public void destroy() {
     274    public synchronized void destroy() {
     275        if (isDestroyed) {
     276            throw new IllegalStateException("The layer has already been destroyed: " + this);
     277        }
     278        isDestroyed = true;
    274279        // Override in subclasses if needed
    275280        removeColorPropertyListener();
Note: See TracChangeset for help on using the changeset viewer.