You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Race condition in AnnotationModel.getAnnotationIterator() #4439
This happens intermittently in our RCP app when we are closing and reopening an editor and annotating it. It seems to happen because in AnnotationModel.getAnnotationIterator(boolean, boolean) you first get the keySet iterator Iterator<Object> it= fAttachments.keySet().iterator() and then you iterate over the keys and get the value fAttachments.get(it.next()).getAnnotationIterator(). But if another thread removes an entry in the map in between, it will cause a NPE.
So a fix would be to simply iterate over the values directly, since we are not doing anything with the keys anyway (except getting the value).
I expected: No Exception
But got: Null Pointer Exception
Here is some relevant log output
Exception in thread "Thread-80" java.lang.NullPointerException: Cannot invoke "org.eclipse.jface.text.source.IAnnotationModel.getAnnotationIterator()" because the return value of "java.util.Map.get(Object)" is null
at org.eclipse.jface.text.source.AnnotationModel.getAnnotationIterator(AnnotationModel.java:791)
at org.eclipse.jface.text.source.AnnotationModel.getAnnotationIterator(AnnotationModel.java:712)
at org.eclipse.jface.text.source.projection.ProjectionSummary.removeSummaries(ProjectionSummary.java:181)
at org.eclipse.jface.text.source.projection.ProjectionSummary.internalUpdateSummaries(ProjectionSummary.java:159)
at org.eclipse.jface.text.source.projection.ProjectionSummary$Summarizer.run(ProjectionSummary.java:75)
Tested under this environment:
OS & version: MacOS Tahoe 26.6.2
Eclipse IDE/Platform version (as shown in Help > About): 2026-09 (4.41.0)
I will make a PR for this, thanks!
Community
I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
Activity
Race condition in AnnotationModel.getAnnotationIterator() eclipse-pla…
Race condition in AnnotationModel.getAnnotationIterator() eclipse-pla…