assert that ModelBranch can only be created in a read action (IDEA-CR-65317)

GitOrigin-RevId: 23f917ff162b8d472f900c1704de3257c7c4d86d
This commit is contained in:
Peter Gromov
2020-07-22 06:04:33 +00:00
committed by intellij-monorepo-bot
parent 3e7725fee7
commit 2e39eb6e2c
@@ -3,6 +3,7 @@ package com.intellij.model;
import com.intellij.injected.editor.VirtualFileWindow;
import com.intellij.model.psi.PsiSymbolReference;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.impl.DocumentImpl;
@@ -42,6 +43,7 @@ public final class ModelBranchImpl implements ModelBranch {
private ModelBranchImpl(@NotNull Project project) {
myProject = project;
ApplicationManager.getApplication().assertReadAccessAllowed();
if (PsiDocumentManager.getInstance(project).hasEventSystemEnabledUncommittedDocuments()) {
throw new IllegalStateException("Model branches may only be created on committed PSI");
}