Skip to content

Commit 201028b

Browse files
authored
Merge pull request #20 from jnareb/fix-getASTStructureElement-crash
EyeTracker: wrap call to getASTStructureElement() in runReadAction()
2 parents 5a28ae1 + 844a9d6 commit 201028b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/trackers/EyeTracker.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
1010
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
1111
import com.intellij.openapi.project.Project;
12+
import com.intellij.openapi.util.Computable;
1213
import com.intellij.openapi.vfs.VirtualFile;
1314
import com.intellij.psi.PsiDocumentManager;
1415
import com.intellij.psi.PsiElement;
@@ -250,7 +251,9 @@ public void processRawData(String message) {
250251
location.setAttribute("column", String.valueOf(logicalPosition.column));
251252
location.setAttribute("path", RelativePathGetter.getRelativePath(filePath, projectPath));
252253
gaze.appendChild(location);
253-
Element aSTStructure = getASTStructureElement(psiElement);
254+
Element aSTStructure = ApplicationManager.getApplication().runReadAction(
255+
(Computable<Element>) () -> getASTStructureElement(psiElement)
256+
);
254257
gaze.appendChild(aSTStructure);
255258
lastElement = psiElement;
256259
// System.out.println(gaze.getAttribute("timestamp") + " " + System.currentTimeMillis());

0 commit comments

Comments
 (0)