From b8942e68ca46cc624e85b9b9f8c2ace65d792f77 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 25 Nov 2025 10:32:52 +0100 Subject: [PATCH] [structure view] force file structure update when editor underneath becomes invalid - if you focus file structure and close the editor tab, the file editor becomes invalid, but the file structure is not disposed automatically - this also fixes exceptions caused by work with invalid editor ^KTIJ-34720 fixed GitOrigin-RevId: 20c201cb53b6bb211d925f0f9cb44ef8bbdcedc8 --- .../src/com/intellij/ide/impl/StructureViewWrapperImpl.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.kt b/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.kt index 05496af2b1de..64a24feb7304 100644 --- a/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.kt +++ b/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.kt @@ -249,8 +249,10 @@ class StructureViewWrapperImpl( return } val dataContext = DataManager.getInstance().getDataContext(owner) - if (WRAPPER_DATA_KEY.getData(dataContext) === this) return - if (CommonDataKeys.PROJECT.getData(dataContext) !== project) return + // do not update view if current structure view is in focus, but proceed if a file was closed + if (WRAPPER_DATA_KEY.getData(dataContext) === this && myFileEditor?.isValid == true) return + val aProject = CommonDataKeys.PROJECT.getData(dataContext) + if (aProject != null && aProject !== project) return if (insideToolwindow) { if (myFirstRun) { setFileFromSelectionHistory()