Skip to content

Commit

Permalink
Add lock object to fDocument in DocumentAdapter.initialize()
Browse files Browse the repository at this point in the history
This change adds a lock object to `Document` use in `DocumentAdapter`, in order to prevent concurrent text buffer access. See: eclipse-platform/eclipse.platform.ui#1059
  • Loading branch information
trancexpress authored and iloveeclipse committed May 7, 2024
1 parent 9bad85c commit 3ad6499
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ private void initialize() {
fTextFileBuffer= manager.getTextFileBuffer(fPath, fLocationKind);
}
fDocument= fTextFileBuffer.getDocument();
if (fDocument instanceof ISynchronizable sDocument && sDocument.getLockObject() == null) {
sDocument.setLockObject(new Object());
}
} catch (CoreException x) {
fDocument= manager.createEmptyDocument(fPath, fLocationKind);
if (fDocument instanceof ISynchronizable)
Expand Down

0 comments on commit 3ad6499

Please sign in to comment.