Skip to content

Commit 703a1ad

Browse files
Fix for multi-threading issues in AnnotationMap
- added synchronize block to methods in AnnotationModel, wherever reads / writes could happen in multiple threads. - changed execution order, to be able to synchronize only necessary code blocks. Co-authored-by: Andrey Loskutov <[email protected]>
1 parent 26f9e0e commit 703a1ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bundles/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ private void cleanup(boolean fireModelChanged, boolean forkNotification) {
679679
ArrayList<Annotation> deleted= new ArrayList<>();
680680
IAnnotationMap annotations= getAnnotationMap();
681681
Object mapLock = annotations.getLockObject();
682-
Assert.isNotNull(mapLock);
682+
683683
synchronized (mapLock) {
684684
annotations.forEach((a, p) -> {
685685
if (p == null || p.isDeleted()) {
@@ -690,7 +690,7 @@ private void cleanup(boolean fireModelChanged, boolean forkNotification) {
690690

691691
if (fireModelChanged && forkNotification) {
692692
removeAnnotations(deleted, false, false);
693-
synchronized (getLockObject()) {
693+
synchronized (mapLock) {
694694
if (fModelEvent != null) {
695695
final AnnotationModelEvent event = fModelEvent;
696696
fModelEvent = null;

0 commit comments

Comments
 (0)