Bug 376206 - [prefs] EclipsePreferences creates deadlock risk
by synchronizing on a public object
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
index 5659cc6..9203459 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
@@ -1137,7 +1137,12 @@
 	 * @param pool The pool to share strings in
 	 */
 	public void shareStrings(StringPool pool) {
-		properties.shareStrings(pool);
+		//thread safety: copy reference in case of concurrent change	
+		ImmutableMap temp;
+		synchronized (childAndPropertyLock) {
+			temp = properties;
+		}
+		temp.shareStrings(pool);
 		IEclipsePreferences[] myChildren = getChildren(false);
 		for (int i = 0; i < myChildren.length; i++)
 			if (myChildren[i] instanceof EclipsePreferences)