diff options
author | Sarika Sinha | 2015-12-03 10:57:00 +0000 |
---|---|---|
committer | Sarika Sinha | 2015-12-03 10:57:00 +0000 |
commit | d91efcae543057148210eb78a776790859f635c2 (patch) | |
tree | c5b0c8dee10f519c4994678ba19470848dc19b21 /org.eclipse.debug.ui | |
parent | 45e5c5990b32cb37cd34db49fe88c994c252c142 (diff) | |
download | eclipse.platform.debug-d91efcae543057148210eb78a776790859f635c2.tar.gz eclipse.platform.debug-d91efcae543057148210eb78a776790859f635c2.tar.xz eclipse.platform.debug-d91efcae543057148210eb78a776790859f635c2.zip |
Bug 474006 - ConcurrentModificationException in getLineTrackers (270)I20151229-0800I20151222-0800I20151215-0800I20151213-2000I20151209-2300I20151209-2000I20151209-0800I20151208-2000I20151208-0800I20151207-2000I20151207-0800I20151206-2000I20151203-1230I20151203-0800
Change-Id: I4181f3e41e237b7520e53068f43a0d989ad69081
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java index e4669a68d..c1cc89c2c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -63,7 +63,11 @@ public class ProcessConsoleManager implements ILaunchListener { * Map of processes for a launch to compute removed processes */ private Map<ILaunch, IProcess[]> fProcesses; - + + /** + * Lock for fLineTrackers + */ + private Object fLineTrackersLock = new Object(); /** * @see ILaunchListener#launchRemoved(ILaunch) */ @@ -248,32 +252,37 @@ public class ProcessConsoleManager implements ILaunchListener { String type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE); if (fLineTrackers == null) { - fLineTrackers = new HashMap<String, List<IConfigurationElement>>(); - IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_LINE_TRACKERS); - IConfigurationElement[] elements = extensionPoint.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement extension = elements[i]; - String processType = extension.getAttribute("processType"); //$NON-NLS-1$ - List<IConfigurationElement> list = fLineTrackers.get(processType); - if (list == null) { - list = new ArrayList<IConfigurationElement>(); - fLineTrackers.put(processType, list); - } - list.add(extension); - } + synchronized (fLineTrackersLock) { // can't use fLineTrackers as lock as it is null here + fLineTrackers = new HashMap<String, List<IConfigurationElement>>(); + IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_LINE_TRACKERS); + IConfigurationElement[] elements = extensionPoint.getConfigurationElements(); + for (int i = 0; i < elements.length; i++) { + IConfigurationElement extension = elements[i]; + String processType = extension.getAttribute("processType"); //$NON-NLS-1$ + List<IConfigurationElement> list = fLineTrackers.get(processType); + if (list == null) { + list = new ArrayList<IConfigurationElement>(); + fLineTrackers.put(processType, list); + } + list.add(extension); + } + } } ArrayList<IConsoleLineTracker> trackers = new ArrayList<IConsoleLineTracker>(); if (type != null) { - List<IConfigurationElement> lineTrackerExtensions = fLineTrackers.get(type); + List<IConfigurationElement> lineTrackerExtensions; + synchronized (fLineTrackers) {// need to synchronize as the update to list might be still happening + lineTrackerExtensions = fLineTrackers.get(type); + } if(lineTrackerExtensions != null) { for (IConfigurationElement element : lineTrackerExtensions) { - try { + try { trackers.add((IConsoleLineTracker) element.createExecutableExtension("class")); //$NON-NLS-1$ } catch (CoreException e) { DebugUIPlugin.log(e); } - } + } } } return trackers.toArray(new IConsoleLineTracker[0]); |