mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 209770: CConfigBasedDescriptor.get not thread-safe
This commit is contained in:
parent
ad075de767
commit
5a608fee1c
1 changed files with 50 additions and 45 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* Copyright (c) 2007, 2008 Intel 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core;
|
||||
|
||||
|
@ -48,14 +49,14 @@ public class CConfigBasedDescriptor implements ICDescriptor {
|
|||
private ICConfigurationDescription fCfgDes;
|
||||
private IProject fProject;
|
||||
private COwner fOwner;
|
||||
private HashMap fDesMap = new HashMap();
|
||||
private HashMap fStorageDataElMap = new HashMap();
|
||||
private final HashMap fDesMap = new HashMap();
|
||||
private final HashMap fStorageDataElMap = new HashMap();
|
||||
private boolean fApplyOnChange = true;
|
||||
private boolean fIsDirty;
|
||||
private CDescriptorEvent fOpEvent;
|
||||
private boolean fIsOpStarted;
|
||||
|
||||
class CConfigBaseDescriptorExtensionReference implements ICExtensionReference{
|
||||
final class CConfigBaseDescriptorExtensionReference implements ICExtensionReference{
|
||||
private ICConfigExtensionReference fCfgExtRef;
|
||||
CConfigBaseDescriptorExtensionReference(ICConfigExtensionReference cfgRef){
|
||||
fCfgExtRef = cfgRef;
|
||||
|
@ -191,6 +192,7 @@ public class CConfigBasedDescriptor implements ICDescriptor {
|
|||
|
||||
private CConfigBaseDescriptorExtensionReference create(ICConfigExtensionReference ref){
|
||||
CConfigBaseDescriptorExtensionReference dr = new CConfigBaseDescriptorExtensionReference(ref);
|
||||
synchronized (fDesMap) {
|
||||
ArrayList list = (ArrayList)fDesMap.get(ref.getExtensionPoint());
|
||||
if(list == null){
|
||||
list = new ArrayList(1);
|
||||
|
@ -199,6 +201,7 @@ public class CConfigBasedDescriptor implements ICDescriptor {
|
|||
list.ensureCapacity(list.size() + 1);
|
||||
}
|
||||
list.add(dr);
|
||||
}
|
||||
return dr;
|
||||
}
|
||||
|
||||
|
@ -228,6 +231,7 @@ public class CConfigBasedDescriptor implements ICDescriptor {
|
|||
}
|
||||
|
||||
ICExtensionReference[] extRefs = new ICExtensionReference[cfgRefs.length];
|
||||
synchronized (fDesMap) {
|
||||
ArrayList list = (ArrayList)fDesMap.get(extensionPoint);
|
||||
// if(list == null){
|
||||
// list = new ArrayList(cfgRefs.length);
|
||||
|
@ -267,6 +271,7 @@ public class CConfigBasedDescriptor implements ICDescriptor {
|
|||
|
||||
list.addAll(Arrays.asList(extRefs));
|
||||
list.trimToSize();
|
||||
}
|
||||
return extRefs;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue