From 4028d882feae656baad30becacf728343e29450e Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 16 May 2019 11:53:29 -0400 Subject: [PATCH] Bug 547398 - Fix ConcurrentModificationException in ToolChainManager - fix references of orderedToolChains list in for loops to use array copy Change-Id: Id6ad9ae5e680ed581a2b3ceddf2bfc19b68dcccd --- .../eclipse/cdt/internal/core/build/ToolChainManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java index 3341a862cc0..c13682b6a30 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. + * Copyright (c) 2015, 2019 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -117,7 +117,7 @@ public class ToolChainManager implements IToolChainManager { .node("order"); //$NON-NLS-1$ prefs.put("n", Integer.toString(orderedToolChains.size())); //$NON-NLS-1$ int i = 0; - for (IToolChain toolChain : orderedToolChains) { + for (IToolChain toolChain : orderedToolChains.toArray(new IToolChain[0])) { prefs.put(Integer.toString(i) + ".type", toolChain.getTypeId()); //$NON-NLS-1$ prefs.put(Integer.toString(i) + ".id", toolChain.getId()); //$NON-NLS-1$ i++; @@ -191,7 +191,7 @@ public class ToolChainManager implements IToolChainManager { init(); List tcs = new ArrayList<>(); if (orderedToolChains != null) { - for (IToolChain toolChain : orderedToolChains) { + for (IToolChain toolChain : orderedToolChains.toArray(new IToolChain[0])) { boolean matches = true; for (Map.Entry property : properties.entrySet()) { String tcProperty = toolChain.getProperty(property.getKey());