Changeset 17541 in josm


Ignore:
Timestamp:
2021-02-24T22:44:13+01:00 (4 years ago)
Author:
Don-vip
Message:

see #16567 - better synchronization of Preferences.settingsMap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r16622 r17541  
    518518     * @throws IOException if any I/O error occurs
    519519     */
    520     public void fromXML(Reader in) throws XMLStreamException, IOException {
     520    public synchronized void fromXML(Reader in) throws XMLStreamException, IOException {
    521521        PreferencesReader reader = new PreferencesReader(in, false);
    522522        reader.parse();
     
    529529     * @param reset if {@code true}, current settings file is replaced by the default one
    530530     */
    531     public void init(boolean reset) {
     531    public synchronized void init(boolean reset) {
    532532        initSuccessful = false;
    533533        // get the preferences.
     
    671671     * Reset all values stored in this map to the default values. This clears the preferences.
    672672     */
    673     public final void resetToDefault() {
     673    public final synchronized void resetToDefault() {
    674674        settingsMap.clear();
    675675    }
     
    683683     */
    684684    @Override
    685     public boolean putSetting(final String key, Setting<?> setting) {
     685    public synchronized boolean putSetting(final String key, Setting<?> setting) {
    686686        CheckParameterUtil.ensureParameterNotNull(key);
    687687        if (setting != null && setting.getValue() == null)
     
    816816     * @return XML
    817817     */
    818     public String toXML(boolean nopass) {
     818    public synchronized String toXML(boolean nopass) {
    819819        return toXML(settingsMap.entrySet(), nopass, false);
    820820    }
Note: See TracChangeset for help on using the changeset viewer.