From 867742a462705c5275329ece9d33616a95f45509 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 10 Dec 2024 17:46:45 +0000 Subject: [PATCH] Don't call updateEditors when there are no editors on that file Callees from updateEditors, including arbitrary third-party notification providers, can have side-effects, such as instantiating PsiFile instances for the VirtualFiles. These PsiFiles can then be spurious: if there is more than one project open, we might end up with a PsiFile with PsiFile.project = ProjectA, where the VirtualFile in fact belongs to ProjectB. --- .../src/com/intellij/ui/EditorNotificationsImpl.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt b/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt index 36edec9c4ec13..903a166387677 100644 --- a/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt +++ b/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt @@ -203,7 +203,9 @@ class EditorNotificationsImpl(private val project: Project, visible } } - updateEditors(file = file, fileEditors = editors.toList()) + if (editors.any()) { + updateEditors(file = file, fileEditors = editors.toList()) + } } private fun getEditors(file: VirtualFile): Sequence { @@ -362,4 +364,4 @@ class EditorNotificationsImpl(private val project: Project, } } } -} \ No newline at end of file +}