[diff] IJPL-180394 Fix missing read lock when accessing caret

(cherry picked from commit a3846d5b890e3036a159136cdd979c6356c31b5e)

IJ-MR-157075

GitOrigin-RevId: 08e1f48769f0d1c4986858846c61dff7f928117b
This commit is contained in:
Ilia.Shulgin
2025-03-06 15:49:25 +01:00
committed by intellij-monorepo-bot
parent f2cfc536e6
commit edfee4abbf

View File

@@ -25,6 +25,7 @@ import com.intellij.diff.util.Side;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataSink;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.event.DocumentEvent;
@@ -265,7 +266,8 @@ public abstract class TwosideTextDiffViewer extends TwosideDiffViewer<TextEditor
public @Nullable Navigatable getNavigatable() {
Side side = getCurrentSide();
LineCol position = LineCol.fromCaret(getEditor(side));
EditorEx editor = getEditor(side);
LineCol position = ReadAction.compute(() -> LineCol.fromCaret(editor));
Navigatable navigatable = getContent(side).getNavigatable(position);
if (navigatable != null) return navigatable;