Changeset 19160 in josm


Ignore:
Timestamp:
2024-07-30T15:13:18+02:00 (4 months ago)
Author:
taylor.smock
Message:

Fix #23825: UI appears to freeze when a multi-select option is used

There are two problems fixed here:

  1. The ListSelectionListener gets called twice; this is fixed by waiting for the list value to stop changing.
  2. The act of applyChangeTags clones any primitive that might be affected by the tag change of the primitive. This can get pretty expensive if relations are involved. This is fixed by cloning the primitive in a different thread.
Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidation.java

    r18918 r19160  
    4545     */
    4646    static void validateAsync(OsmPrimitive original, JLabel validationLabel, List<Tag> changedTags) {
    47         OsmPrimitive primitive = applyChangedTags(original, changedTags);
    48         MainApplication.worker.execute(() -> validate(primitive, validationLabel));
     47        MainApplication.worker.execute(() -> {
     48            // applyChangedTags can be very expensive if a relation gets involved, so it must be done in
     49            // a separate thread. This is becuase it clones all potentially affected objects.
     50            OsmPrimitive primitive = applyChangedTags(original, changedTags);
     51            validate(primitive, validationLabel);
     52        });
    4953    }
    5054
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelect.java

    r18265 r19160  
    9595        p.add(sp, GBC.eol().fill(GBC.HORIZONTAL)); // NOSONAR
    9696
    97         list.addListSelectionListener(l -> support.fireItemValueModified(this, key, getSelectedItem().value));
     97        list.addListSelectionListener(l -> {
     98            if (!l.getValueIsAdjusting()) {
     99                support.fireItemValueModified(this, key, getSelectedItem().value);
     100            }
     101        });
    98102        list.setToolTipText(getKeyTooltipText());
    99103        list.applyComponentOrientation(OrientationAction.getValueOrientation(key));
  • trunk/src/org/openstreetmap/josm/io/CertificateAmendment.java

    r19158 r19160  
    2222import java.security.cert.TrustAnchor;
    2323import java.security.cert.X509Certificate;
    24 import java.util.Arrays;
    2524import java.util.Collection;
    2625import java.util.Collections;
Note: See TracChangeset for help on using the changeset viewer.