From ff08d03138a8d45c19453c966c5efd94511c02f9 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 9 Feb 2016 17:13:16 +0100 Subject: [PATCH] take read action in smart pointer comparison (EA-77398 - assert: PsiFileImpl.getStubTree) --- .../impl/smartPointers/SelfElementInfo.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java index 66d77e0495c5..46f743369a13 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java +++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SelfElementInfo.java @@ -227,15 +227,19 @@ public class SelfElementInfo extends SmartPointerElementInfo { @Override public boolean pointsToTheSameElementAs(@NotNull final SmartPointerElementInfo other) { if (other instanceof SelfElementInfo) { - SelfElementInfo otherInfo = (SelfElementInfo)other; + final SelfElementInfo otherInfo = (SelfElementInfo)other; if (!getVirtualFile().equals(other.getVirtualFile()) || myType != otherInfo.myType) return false; - Segment range1 = getPsiRange(); - Segment range2 = otherInfo.getPsiRange(); - return range1 != null && range2 != null - && range1.getStartOffset() == range2.getStartOffset() - && range1.getEndOffset() == range2.getEndOffset() - ; + return ApplicationManager.getApplication().runReadAction(new Computable() { + @Override + public Boolean compute() { + Segment range1 = getPsiRange(); + Segment range2 = otherInfo.getPsiRange(); + return range1 != null && range2 != null + && range1.getStartOffset() == range2.getStartOffset() + && range1.getEndOffset() == range2.getEndOffset(); + } + }); } return areRestoredElementsEqual(other); }