From def0b7a1f67d344398f6df1b2651e6ddb7b127c5 Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 28 May 2016 12:59:57 +0200 Subject: [PATCH] add read action to HardElementInfo.pointsToTheSameElementAs (EA-82992 - assert: PsiFileImpl.getStubTree) --- .../psi/impl/smartPointers/HardElementInfo.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/HardElementInfo.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/HardElementInfo.java index 175408bd29c3..a88db5febb74 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/HardElementInfo.java +++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/HardElementInfo.java @@ -15,8 +15,10 @@ */ package com.intellij.psi.impl.smartPointers; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Segment; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; @@ -54,8 +56,13 @@ class HardElementInfo extends SmartPointerElementInfo { } @Override - public boolean pointsToTheSameElementAs(@NotNull SmartPointerElementInfo other) { - return Comparing.equal(myElement, other.restoreElement()); + public boolean pointsToTheSameElementAs(@NotNull final SmartPointerElementInfo other) { + return Comparing.equal(myElement, ApplicationManager.getApplication().runReadAction(new Computable() { + @Override + public PsiElement compute() { + return other.restoreElement(); + } + })); } @Override