diff options
author | Alexey Ushakov <Alexey.Ushakov@jetbrains.com> | 2018-06-01 11:55:37 +0300 |
---|---|---|
committer | Alexey Ushakov <Alexey.Ushakov@jetbrains.com> | 2018-06-01 12:36:22 +0300 |
commit | ef5de94150f84aeae3552fd602a9d6e0cb335abb (patch) | |
tree | 51c0b6ad6e2ae6cbac5388aa53b993094ed11795 | |
parent | 6f70efac29f5b4cca2d45439943a3e5f7bb4afc3 (diff) | |
download | jdk8u_jdk-ef5de94150f84aeae3552fd602a9d6e0cb335abb.tar.gz |
JRE-834 IAE in RepaintManagerjb8u152-b1248.6
Skipped empty rectangles
(cherry picked from commit 3550bf1)
-rw-r--r-- | src/share/classes/javax/swing/RepaintManager.java | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/share/classes/javax/swing/RepaintManager.java b/src/share/classes/javax/swing/RepaintManager.java index 0b50e7747d..d656880966 100644 --- a/src/share/classes/javax/swing/RepaintManager.java +++ b/src/share/classes/javax/swing/RepaintManager.java @@ -842,24 +842,27 @@ public class RepaintManager localBoundsW, localBoundsH, rect); - if (dirtyComponent instanceof JComponent) { - ((JComponent)dirtyComponent).paintImmediately( - rect.x,rect.y,rect.width, rect.height); - } - else if (dirtyComponent.isShowing()) { - Graphics g = JComponent.safelyGetGraphics( - dirtyComponent, dirtyComponent); - // If the Graphics goes away, it means someone disposed of - // the window, don't do anything. - if (g != null) { - g.setClip(rect.x, rect.y, rect.width, rect.height); - try { - dirtyComponent.paint(g); - } finally { - g.dispose(); + + if (!rect.isEmpty()) { + if (dirtyComponent instanceof JComponent) { + ((JComponent) dirtyComponent).paintImmediately( + rect.x, rect.y, rect.width, rect.height); + } else if (dirtyComponent.isShowing()) { + Graphics g = JComponent.safelyGetGraphics( + dirtyComponent, dirtyComponent); + // If the Graphics goes away, it means someone disposed of + // the window, don't do anything. + if (g != null) { + g.setClip(rect.x, rect.y, rect.width, rect.height); + try { + dirtyComponent.paint(g); + } finally { + g.dispose(); + } } } } + // If the repaintRoot has been set, service it now and // remove any components that are children of repaintRoot. if (repaintRoot != null) { |