提交 3faf0839 编写于 作者: A alexp

6653511: JComponent.safelyGetGraphics() may sometimes return null

Reviewed-by: rupashka
上级 483b53a0
...@@ -5158,9 +5158,8 @@ public abstract class JComponent extends Container implements Serializable, ...@@ -5158,9 +5158,8 @@ public abstract class JComponent extends Container implements Serializable,
} }
} }
} }
try { try {
g = safelyGetGraphics(paintingComponent, c); if ((g = safelyGetGraphics(paintingComponent, c)) != null) {
try { try {
if (hasBuffer) { if (hasBuffer) {
RepaintManager rm = RepaintManager.currentManager( RepaintManager rm = RepaintManager.currentManager(
...@@ -5175,16 +5174,16 @@ public abstract class JComponent extends Container implements Serializable, ...@@ -5175,16 +5174,16 @@ public abstract class JComponent extends Container implements Serializable,
} finally { } finally {
rm.endPaint(); rm.endPaint();
} }
} } else {
else { g.setClip(paintImmediatelyClip.x, paintImmediatelyClip.y,
g.setClip(paintImmediatelyClip.x,paintImmediatelyClip.y, paintImmediatelyClip.width, paintImmediatelyClip.height);
paintImmediatelyClip.width,paintImmediatelyClip.height);
paintingComponent.paint(g); paintingComponent.paint(g);
} }
} finally { } finally {
g.dispose(); g.dispose();
} }
} }
}
finally { finally {
// Reset the painting child for the parent components. // Reset the painting child for the parent components.
if(paintingComponent != this) { if(paintingComponent != this) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册