From 13b1894c4c5003a8b7697b90ca1208b047c9798e Mon Sep 17 00:00:00 2001 From: Chin Huat Ang Date: Wed, 7 Mar 2018 23:50:43 +0800 Subject: [PATCH] Bug 531991 - Fix command launcher manager priority comparison When iterating through a list of command launcher factory to select the highest priority factory, be sure to compare using the last known highest priority. Change-Id: I473ac9c8ff7cfb5a0aa81714101a795816fd1ac8 Signed-off-by: Chin Huat Ang --- .../org/eclipse/cdt/core/CommandLauncherManager.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java index 79bd82987d1..6db98c2bf27 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java @@ -178,8 +178,10 @@ public class CommandLauncherManager { for (ICommandLauncherFactory factory : factories) { ICommandLauncher launcher = factory.getCommandLauncher(project); if (launcher != null) { - if (priorityMapping.get(factory) > highestPriority) { + int factoryPriority = priorityMapping.get(factory); + if (factoryPriority > highestPriority) { bestLauncher = launcher; + highestPriority = factoryPriority; } } } @@ -206,8 +208,10 @@ public class CommandLauncherManager { if (factory instanceof ICommandLauncherFactory2) { ICommandLauncher launcher = ((ICommandLauncherFactory2)factory).getCommandLauncher(config); if (launcher != null) { - if (priorityMapping.get(factory) > highestPriority) { + int factoryPriority = priorityMapping.get(factory); + if (factoryPriority > highestPriority) { bestLauncher = launcher; + highestPriority = factoryPriority; } } } @@ -233,8 +237,10 @@ public class CommandLauncherManager { for (ICommandLauncherFactory factory : factories) { ICommandLauncher launcher = factory.getCommandLauncher(cfgd); if (launcher != null) { - if (priorityMapping.get(factory) > highestPriority) { + int factoryPriority = priorityMapping.get(factory); + if (factoryPriority > highestPriority) { bestLauncher = launcher; + highestPriority = factoryPriority; } } }