6903354
: deadlock involving Component.show & SunToolkit.getImageFromHash
Reviewed-by: art, bae
This commit is contained in:
parent
b0a13700e1
commit
7eb100548d
@ -800,9 +800,9 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SoftCache imgCache = new SoftCache();
|
static final SoftCache imgCache = new SoftCache();
|
||||||
|
|
||||||
static synchronized Image getImageFromHash(Toolkit tk, URL url) {
|
static Image getImageFromHash(Toolkit tk, URL url) {
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
try {
|
try {
|
||||||
@ -830,6 +830,7 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
sm.checkConnect(url.getHost(), url.getPort());
|
sm.checkConnect(url.getHost(), url.getPort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
synchronized (imgCache) {
|
||||||
Image img = (Image)imgCache.get(url);
|
Image img = (Image)imgCache.get(url);
|
||||||
if (img == null) {
|
if (img == null) {
|
||||||
try {
|
try {
|
||||||
@ -840,13 +841,15 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
}
|
}
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static synchronized Image getImageFromHash(Toolkit tk,
|
static Image getImageFromHash(Toolkit tk,
|
||||||
String filename) {
|
String filename) {
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkRead(filename);
|
security.checkRead(filename);
|
||||||
}
|
}
|
||||||
|
synchronized (imgCache) {
|
||||||
Image img = (Image)imgCache.get(filename);
|
Image img = (Image)imgCache.get(filename);
|
||||||
if (img == null) {
|
if (img == null) {
|
||||||
try {
|
try {
|
||||||
@ -857,6 +860,7 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
}
|
}
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Image getImage(String filename) {
|
public Image getImage(String filename) {
|
||||||
return getImageFromHash(this, filename);
|
return getImageFromHash(this, filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user