From f680907cabc02d1d89a0f57056f01c700f27bf2b Mon Sep 17 00:00:00 2001 From: Ali Azam Rana <85216275+alirana01@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:02:41 +0200 Subject: [PATCH] fix(908): fix for the cmake tool chain removal function. (#909) Resolves that the calculated ID in the removal function was different than the one in the add Fixes #908 --- .../core/internal/CMakeToolChainManager.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java index f7f2088e983..b4121d0b5aa 100644 --- a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java +++ b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java @@ -156,20 +156,18 @@ public void addToolChainFile(ICMakeToolChainFile file) { public void removeToolChainFile(ICMakeToolChainFile file) { init(); fireEvent(new CMakeToolChainEvent(CMakeToolChainEvent.REMOVED, file)); - String tcId = makeToolChainId(file.getProperty(CMakeBuildConfiguration.TOOLCHAIN_TYPE), - file.getProperty(CMakeBuildConfiguration.TOOLCHAIN_ID)); - filesByToolChain.remove(tcId); - - String n = ((CMakeToolChainFile) file).n; - if (n != null) { - Preferences prefs = getPreferences(); - Preferences tcNode = prefs.node(n); - try { + try { + String tcId = makeToolChainId(file.getToolChain()); + filesByToolChain.remove(tcId); + String n = ((CMakeToolChainFile) file).n; + if (n != null) { + Preferences prefs = getPreferences(); + Preferences tcNode = prefs.node(n); tcNode.removeNode(); prefs.flush(); - } catch (BackingStoreException e) { - Activator.log(e); } + } catch (CoreException | BackingStoreException e) { + Activator.log(e); } }