For certain kinds of edits (at least creating/removing fields and annotations), the syntax highlighter schedules a call to SemanticHighlightingPresenter.updatePresentation on the UI thread, which obtains fPositionLock and then calls synchronized methods of PadDocument.
However, other threads call e.g. synchronized PadDocument.replace which ends up making a synchronous callback to the highlighter, which then obtains fPositionLock.
Without changing the how PadDocuments are made threadsafe, straightforward solution is to use Display.asyncExec in PadCompilationUnitEditor.reconciled to make the callback asynchronous.
For certain kinds of edits (at least creating/removing fields and annotations), the syntax highlighter schedules a call to
SemanticHighlightingPresenter.updatePresentation
on the UI thread, which obtainsfPositionLock
and then calls synchronized methods ofPadDocument
.However, other threads call e.g. synchronized
PadDocument.replace
which ends up making a synchronous callback to the highlighter, which then obtainsfPositionLock
.Without changing the how
PadDocument
s are made threadsafe, straightforward solution is to useDisplay.asyncExec
inPadCompilationUnitEditor.reconciled
to make the callback asynchronous.Hopefully that will not introduce other bugs?
(Imported from Bitbucket #57 reported by maxg on 2011-11-09)