-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
None
-
beta
-
generic
-
generic
This code is on about line 3119 of Component.java
public void show() {
if (backBuffers == null) {
return;
}
Graphics g = getGraphics();
for (int i = 0; i < backBuffers.length; i++) {
g.drawImage(backBuffers[i], 0, 0, Component.this);
g.dispose();
g = backBuffers[i].getGraphics();
}
g.dispose();
}
We need to wrap the Graphics we get from getGraphics and createGraphics
calls in a try/finally block to explicitly dispose them in case of an
exception. I suggest:
try {
for (int i = 0; i < backBuffers.length; i++) {
g.drawImage(backBuffers[i], 0, 0, Component.this);
g.dispose();
g = null;
g = backBuffers[i].getGraphics();
}
} finally {
if (g != null) {
g.dispose();
}
}
public void show() {
if (backBuffers == null) {
return;
}
Graphics g = getGraphics();
for (int i = 0; i < backBuffers.length; i++) {
g.drawImage(backBuffers[i], 0, 0, Component.this);
g.dispose();
g = backBuffers[i].getGraphics();
}
g.dispose();
}
We need to wrap the Graphics we get from getGraphics and createGraphics
calls in a try/finally block to explicitly dispose them in case of an
exception. I suggest:
try {
for (int i = 0; i < backBuffers.length; i++) {
g.drawImage(backBuffers[i], 0, 0, Component.this);
g.dispose();
g = null;
g = backBuffers[i].getGraphics();
}
} finally {
if (g != null) {
g.dispose();
}
}