diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java index 8afe127916d..dc6aa8eed64 100644 --- a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java +++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java @@ -1057,22 +1057,44 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration @Override public void launchConfigurationRemoved(ILaunchConfiguration configuration) { Activator.trace("launch config removed " + configuration); - - try { - LaunchConfigProviderInfo info = configProviders.get(configuration.getType().getIdentifier()); - if (info != null) { - ILaunchConfigurationProvider provider = info.getProvider(); - if (provider.launchConfigurationRemoved(configuration)) { - Activator.trace("launch config removed by " + provider); - return; + + // Is there any way this method is called when a LC still exists??? This may be dead code. + // configuration.getType() will fail when !configuration.exists() + if (configuration.exists()) { + try { + LaunchConfigProviderInfo info = configProviders.get(configuration.getType().getIdentifier()); + if (info != null) { + ILaunchConfigurationProvider provider = info.getProvider(); + if (provider.launchConfigurationRemoved(configuration)) { + Activator.trace("launch config removed by " + provider); + return; + } } + } catch (CoreException e) { + Activator.log(e.getStatus()); } - } catch (CoreException e) { - Activator.log(e.getStatus()); } Activator.trace("launch config not claimed"); ILaunchDescriptor desc = objectDescriptorMap.get(configuration); + if (desc == null) { + /* WARNING: This is slow. Call only as a last resort */ + Iterator>> iter = configs.entrySet().iterator(); + while (iter.hasNext()) { + Entry> e1 = iter.next(); + if (e1.getValue().containsValue(configuration)) { + Iterator> iter2 = e1.getValue().entrySet().iterator(); + while (iter2.hasNext()) { + Entry e2 = iter2.next(); + if (e2.getValue().equals(configuration)) { + e1.getValue().remove((ILaunchConfigurationProvider) e2.getKey()); + return; + } + } + break; + } + } + } try { removeDescriptor(configuration, desc); } catch (CoreException e) {