Changeset 8367 in josm


Ignore:
Timestamp:
2015-05-16T16:43:46+02:00 (10 years ago)
Author:
Don-vip
Message:

fix synchronization issue seen in unit test

File:
1 edited

Legend:

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

    r8308 r8367  
    493493         * @return a summary of the current JOSM selection
    494494         */
    495         public String getJOSMSelectionSummary() {
     495        public synchronized String getJOSMSelectionSummary() {
    496496            if (selection.isEmpty()) return tr("Selection");
    497497            int numNodes = 0;
     
    545545
    546546        @Override
    547         public OsmPrimitive getElementAt(int index) {
     547        public synchronized OsmPrimitive getElementAt(int index) {
    548548            return selection.get(index);
    549549        }
    550550
    551551        @Override
    552         public int getSize() {
     552        public synchronized int getSize() {
    553553            return selection.size();
    554554        }
     
    560560         * @return choosen elements in the view
    561561         */
    562         public Collection<OsmPrimitive> getSelected() {
     562        public synchronized Collection<OsmPrimitive> getSelected() {
    563563            Set<OsmPrimitive> sel = new HashSet<>();
    564564            for(int i=0; i< getSize();i++) {
     
    575575         * @param sel the collection of primitives to select
    576576         */
    577         public void setSelected(Collection<OsmPrimitive> sel) {
     577        public synchronized void setSelected(Collection<OsmPrimitive> sel) {
    578578            selectionModel.clearSelection();
    579579            if (sel == null) return;
     
    598598         * @param selection the collection of currently selected OSM objects
    599599         */
    600         public void setJOSMSelection(final Collection<? extends OsmPrimitive> selection) {
     600        public synchronized void setJOSMSelection(final Collection<? extends OsmPrimitive> selection) {
    601601            this.selection.clear();
    602602            if (selection != null) {
     
    636636         * @param toUpdate the collection of primitives to update
    637637         */
    638         public void update(Collection<? extends OsmPrimitive> toUpdate) {
     638        public synchronized void update(Collection<? extends OsmPrimitive> toUpdate) {
    639639            if (toUpdate == null) return;
    640640            if (toUpdate.isEmpty()) return;
     
    652652         * Sorts the current elements in the selection
    653653         */
    654         public void sort() {
     654        public synchronized void sort() {
    655655            if (this.selection.size() <= Main.pref.getInteger("selection.no_sort_above", 100000)) {
    656656                boolean quick = this.selection.size() > Main.pref.getInteger("selection.fast_sort_above", 10000);
Note: See TracChangeset for help on using the changeset viewer.