1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

Bug 449479 - Fix Exceptions and LC cache corruption on LC delete

Change-Id: Icd211eb1c9c34082208a709926b56affee6eac61
Signed-off-by: Jonathan Williams <jonwilliams@qnx.com>
Reviewed-on: https://git.eclipse.org/r/35748
Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
Tested-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
Jonathan Williams 2014-10-31 11:35:25 -04:00 committed by Doug Schaefer
parent b0874844fc
commit af395d8676

View file

@ -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<Entry<ILaunchDescriptor, Map<ILaunchConfigurationProvider, ILaunchConfiguration>>> iter = configs.entrySet().iterator();
while (iter.hasNext()) {
Entry<ILaunchDescriptor, Map<ILaunchConfigurationProvider, ILaunchConfiguration>> e1 = iter.next();
if (e1.getValue().containsValue(configuration)) {
Iterator<Entry<ILaunchConfigurationProvider, ILaunchConfiguration>> iter2 = e1.getValue().entrySet().iterator();
while (iter2.hasNext()) {
Entry<ILaunchConfigurationProvider, ILaunchConfiguration> e2 = iter2.next();
if (e2.getValue().equals(configuration)) {
e1.getValue().remove((ILaunchConfigurationProvider) e2.getKey());
return;
}
}
break;
}
}
}
try {
removeDescriptor(configuration, desc);
} catch (CoreException e) {