提交 abc121e3 编写于 作者: P prr

7027300: Unsynchronized HashMap access causes endless loop

Reviewed-by: bae, jgodinez
上级 7ec87803
...@@ -33,7 +33,7 @@ package sun.font; ...@@ -33,7 +33,7 @@ package sun.font;
import sun.font.GlyphLayout.*; import sun.font.GlyphLayout.*;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.Locale; import java.util.Locale;
/* /*
...@@ -129,9 +129,9 @@ public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory ...@@ -129,9 +129,9 @@ public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory
// !!! don't need this unless we have more than one sun layout engine... // !!! don't need this unless we have more than one sun layout engine...
public LayoutEngine getEngine(LayoutEngineKey key) { public LayoutEngine getEngine(LayoutEngineKey key) {
HashMap cache = (HashMap)cacheref.get(); ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get();
if (cache == null) { if (cache == null) {
cache = new HashMap(); cache = new ConcurrentHashMap();
cacheref = new SoftReference(cache); cacheref = new SoftReference(cache);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册