From 284efc8c0df4060d0ff1888b6f8d83cc3a9990a6 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Wed, 20 Feb 2019 16:16:35 +0300 Subject: [PATCH] debugger's SourceCodeChecker: avoid using FileEditorManager's UI-related method in a background thread --- .../debugger/impl/SourceCodeChecker.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java b/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java index e3fa3a031ae3..12dbbf426840 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java @@ -126,16 +126,21 @@ public class SourceCodeChecker { LOG.debug("Source check failed: method " + method.name() + " not found in sources"); } if (!res) { - FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(position.getFile().getVirtualFile()); - if (editor instanceof TextEditor) { - AppUIUtil.invokeOnEdt(() -> HintManager.getInstance().showErrorHint(((TextEditor)editor).getEditor(), - DebuggerBundle.message("warning.source.code.not.match"))); - } - else { - XDebuggerManagerImpl.NOTIFICATION_GROUP - .createNotification(DebuggerBundle.message("warning.source.code.not.match"), NotificationType.WARNING) - .notify(project); - } + VirtualFile virtualFile = position.getFile().getVirtualFile(); + AppUIUtil.invokeOnEdt(() -> { + if (!project.isDisposed()) { + FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(virtualFile); + if (editor instanceof TextEditor) { + HintManager.getInstance().showErrorHint(((TextEditor)editor).getEditor(), + DebuggerBundle.message("warning.source.code.not.match")); + } + else { + XDebuggerManagerImpl.NOTIFICATION_GROUP + .createNotification(DebuggerBundle.message("warning.source.code.not.match"), NotificationType.WARNING) + .notify(project); + } + } + }); return ThreeState.NO; } return ThreeState.YES;