Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2015-12-03 05:57:00 -0500
committerSarika Sinha2015-12-03 05:57:00 -0500
commitd91efcae543057148210eb78a776790859f635c2 (patch)
treec5b0c8dee10f519c4994678ba19470848dc19b21
parent45e5c5990b32cb37cd34db49fe88c994c252c142 (diff)
downloadeclipse.platform.debug-d91efcae543057148210eb78a776790859f635c2.tar.gz
eclipse.platform.debug-d91efcae543057148210eb78a776790859f635c2.tar.xz
eclipse.platform.debug-d91efcae543057148210eb78a776790859f635c2.zip
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java45
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]);

Back to the top