Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2016-09-09 11:37:19 +0000
committerAndrey Loskutov2016-09-20 07:13:18 +0000
commit6540c4c82552458c680d5c01672d0c573db2efd7 (patch)
tree9dc6fe25c3398ca24134329b9ba85e7ae36e1006
parent696cc795317725ee09c4d12d59dba43bee17df40 (diff)
downloadeclipse.platform.text-6540c4c82552458c680d5c01672d0c573db2efd7.tar.gz
eclipse.platform.text-6540c4c82552458c680d5c01672d0c573db2efd7.tar.xz
eclipse.platform.text-6540c4c82552458c680d5c01672d0c573db2efd7.zip
Bug 428417 - ConcurrentModificationException inI20160920-0800
AbstractMarkerAnnotationModel The fDeletedAnnotations field in AbstractMarkerAnnotationModel uses ArrayList, which is not thread safe and does not allow concurrent modification and iteration. Introducing new locks around fDeletedAnnotations seem to be dangerous. Replacing this with CopyOnWriteArrayList however seem to be a better solution - it does not add any new locks and should allow safe iteration while other thread modifies the list. Looking at the usage of fDeletedAnnotations, it should be OK to iterate on "old" state. Change-Id: I17fea70fcccf578212e9fdb557a9f0f68aa64dc4 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
index 120c86346f0..f24c70aee1b 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
import org.osgi.framework.Bundle;
@@ -70,7 +71,7 @@ import org.eclipse.ui.editors.text.EditorsUI;
public abstract class AbstractMarkerAnnotationModel extends AnnotationModel implements IPersistableAnnotationModel {
/** List of annotations whose text range became invalid because of document changes */
- private List<Annotation> fDeletedAnnotations= new ArrayList<>(2);
+ private List<Annotation> fDeletedAnnotations= new CopyOnWriteArrayList<>();
/** List of registered and instantiated marker updaters */
private List<IMarkerUpdater> fInstantiatedMarkerUpdaters= null;
/** List of registered but not yet instantiated marker updaters */

Back to the top