summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Beauchamp2013-09-27 09:40:57 (EDT)
committerAndrew Gvozdev2013-09-27 14:24:47 (EDT)
commit360577311ba0f27defba27ed581b41134354c95f (patch)
tree03cf11f528b573352f8395d69bf46edc43fc0d68
parent9dd8b1c50dd820e5ba0c69fb7b0cad708a02705f (diff)
downloadorg.eclipse.cdt-360577311ba0f27defba27ed581b41134354c95f.zip
org.eclipse.cdt-360577311ba0f27defba27ed581b41134354c95f.tar.gz
org.eclipse.cdt-360577311ba0f27defba27ed581b41134354c95f.tar.bz2
Bug 418184 - ConcurrentException in CProjectDescriptionrefs/changes/43/16843/2
Change-Id: Iabda238b8e87ab4dff94284af8ddd3f07ed6c294 Signed-off-by: Serge Beauchamp <sergebeauchamp@mac.com> Reviewed-on: https://git.eclipse.org/r/16843 Reviewed-by: Andrew Gvozdev <angvoz.dev@gmail.com> IP-Clean: Andrew Gvozdev <angvoz.dev@gmail.com> Tested-by: Andrew Gvozdev <angvoz.dev@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java
index bab280e..d30b08a 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 Intel Corporation and others.
+ * Copyright (c) 2007, 2013 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
@@ -9,9 +9,11 @@
* Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.)
* Baltasar Belyavsky (Texas Instruments) - bug 340219: Project metadata files are saved unnecessarily
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 418184 - ConcurrentException in CProjectDescription
*******************************************************************************/
package org.eclipse.cdt.internal.core.settings.model;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -50,7 +52,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
private final HashMap<String, ICConfigurationDescription> fCfgMap = new LinkedHashMap<String, ICConfigurationDescription>();
private boolean fIsReadOnly;
private boolean fIsModified;
- private HashMap<QualifiedName, Object> fPropertiesMap;
+ private Map<QualifiedName, Object> fPropertiesMap;
private boolean fIsLoading;
private boolean fIsApplying;
private boolean fIsCreating;
@@ -177,7 +179,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
(CProjectDescriptionPreferences) mngr.getProjectDescriptionWorkspacePreferences(false),
false);
- fPropertiesMap = new HashMap<QualifiedName, Object>();
+ fPropertiesMap = Collections.synchronizedMap(new HashMap<QualifiedName, Object>());
}
public void updateProject(IProject project) {
@@ -318,8 +320,11 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
}
}
- @SuppressWarnings("unchecked")
- HashMap<QualifiedName, Object> cloneMap = (HashMap<QualifiedName, Object>) base.fPropertiesMap.clone();
+ // Shallow cloning the base map
+ Map<QualifiedName, Object> cloneMap = Collections.synchronizedMap(new HashMap<QualifiedName, Object>());
+ synchronized(base.fPropertiesMap) {
+ cloneMap.putAll(base.fPropertiesMap);
+ }
fPropertiesMap = cloneMap;
}