commit | 52a7f6d48eacc72506ba42a6216246d2b4e441e8 | [log] [tgz] |
---|---|---|
author | Andrey Loskutov <loskutov@gmx.de> | Tue Apr 10 09:44:14 2012 -0400 |
committer | John Arthorne <John_Arthorne@ca.ibm.com> | Tue Apr 10 09:44:14 2012 -0400 |
tree | f692dcd50b8f9705c5b525d4b6c83743f955f61e | |
parent | 087d3b0910013b190998a81e3d49f2b99f7f1e34 [diff] |
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)