Changeset 18704 in josm for trunk/src/org


Ignore:
Timestamp:
2023-04-19T18:03:38+02:00 (18 months ago)
Author:
taylor.smock
Message:

Fix #22865: Pressing "Presets" button causes JOSM to get stuck on loading (macOS)

This is caused by JDK-8297117, and the Name Suggestion Index is the only preset
that should trigger the bug. This works around the issue by preventing the merging
of our MenuBar with the system menu when the Name Suggestion Index may be
enabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r18580 r18704  
    3232import org.openstreetmap.josm.data.Preferences;
    3333import org.openstreetmap.josm.gui.MainApplication;
     34import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader;
    3435import org.openstreetmap.josm.io.CertificateAmendment.NativeCertAmend;
    3536
     
    5051
    5152    @Override
    52     public void preStartupHook() {
     53    public void afterPrefStartupHook() {
    5354        // This will merge our MenuBar into the system menu.
    5455        // MUST be set before Swing is initialized!
    55         // And will not work when one of the system independent LAFs is used.
    56         // They just insist on painting themselves...
    57         Utils.updateSystemProperty("apple.laf.useScreenMenuBar", "true");
     56
     57        // But only use the menu bar if the Name Suggestion Index is not enabled -- see JDK-8297117 (can remove once that is fixed)
     58        // The NSI is especially egregious since it adds something like 8k presets, and is the most likely to trigger JDK-8297117.
     59        if (TaggingPresetReader.getPresetSources().stream().noneMatch(url -> url.contains("name-suggestion-index"))) {
     60            Utils.updateSystemProperty("apple.laf.useScreenMenuBar", "true");
     61        }
    5862        Utils.updateSystemProperty("apple.awt.application.name", "JOSM");
    5963    }
Note: See TracChangeset for help on using the changeset viewer.