Changeset 19016 in josm for trunk/src


Ignore:
Timestamp:
2024-03-11T23:00:21+01:00 (9 months ago)
Author:
taylor.smock
Message:

Fix #23540: When a Linux distribution removes the Bing png from JMapViewer, JOSM hangs when loading a Bing imagery layer

This is due to an interaction between JOSM preferences, the ValidatorDialog, and
the cached Bing imagery layer.

The specific interaction that leads to the freeze is as follows:

  1. User starts process of adding a Bing imagery layer to JOSM
  2. In the EDT we call a synchronized method in MainLayerManager
  3. In the EDT we block on a separate thread that is fetching the Bing attribution data
  4. In the separate thread, we attempt to set cache information in preferences
  5. Setting the preference fires a preference change event
  6. One of the listeners, specifically ValidatorDialog, then calls another synchronized method in MainLayerManager

Steps 2 and 6 are the problem points. This patch fixes that by only
attempting to perform the update by only listening to a specific preference,
instead of all of them.

The alternative to this patch uses Config#addKeyPreferenceChangeListener
instead. This was not done since ToggleDialog is already listening to all
preference changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r19000 r19016  
    744744        super.preferenceChanged(e);
    745745        // see #23430: update selection so that filters are applied
    746         DataSet ds = MainApplication.getLayerManager().getActiveDataSet();
    747         if (ds != null) {
    748             updateSelection(ds.getAllSelected());
     746        if (ValidatorPrefHelper.PREF_FILTER_BY_SELECTION.equals(e.getKey())) {
     747            DataSet ds = MainApplication.getLayerManager().getActiveDataSet();
     748            if (ds != null) {
     749                updateSelection(ds.getAllSelected());
     750            }
    749751        }
    750752    }
Note: See TracChangeset for help on using the changeset viewer.