uid/collabode-issues-test — Issue #57: Deadlock caused by syntax highlighter
Author: maxg
Created: 2011-12-07 20:00:21+00:00
State: open

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 {{{PadDocument}}}s are made threadsafe, straightforward solution is to use {{{Display.asyncExec}}} in {{{PadCompilationUnitEditor.reconciled}}} to make the callback asynchronous.

Hopefully that will not introduce other bugs?

(Imported from [Bitbucket #57](https://bitbucket.org/maxg/collabode/issue/57) reported by [maxg](https://bitbucket.org/maxg) on 2011-11-09)