OpenJDK / jdk8u / jdk8u / jdk
changeset 10042:8f6565182535
8058870: Mac: JFXPanel deadlocks in jnlp mode
Reviewed-by: serb, alexsch
author | ant |
---|---|
date | Wed, 24 Sep 2014 16:29:25 +0400 |
parents | dae860c8ddf1 |
children | 755b15fcac3b |
files | src/share/classes/javax/swing/JComponent.java |
diffstat | 1 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/javax/swing/JComponent.java Tue Sep 23 14:07:49 2014 +0100 +++ b/src/share/classes/javax/swing/JComponent.java Wed Sep 24 16:29:25 2014 +0400 @@ -56,6 +56,7 @@ import java.io.IOException; import java.io.ObjectInputValidation; import java.io.InvalidObjectException; +import java.util.concurrent.atomic.AtomicBoolean; import javax.swing.border.*; import javax.swing.event.*; @@ -352,7 +353,8 @@ private static final int AUTOSCROLLS_SET = 25; private static final int FOCUS_TRAVERSAL_KEYS_FORWARD_SET = 26; private static final int FOCUS_TRAVERSAL_KEYS_BACKWARD_SET = 27; - private static final int REVALIDATE_RUNNABLE_SCHEDULED = 28; + + private transient AtomicBoolean revalidateRunnableScheduled = new AtomicBoolean(false); /** * Temporary rectangles. @@ -4859,16 +4861,11 @@ // To avoid a flood of Runnables when constructing GUIs off // the EDT, a flag is maintained as to whether or not // a Runnable has been scheduled. - synchronized(this) { - if (getFlag(REVALIDATE_RUNNABLE_SCHEDULED)) { - return; - } - setFlag(REVALIDATE_RUNNABLE_SCHEDULED, true); + if (revalidateRunnableScheduled.getAndSet(true)) { + return; } SunToolkit.executeOnEventHandlerThread(this, () -> { - synchronized(JComponent.this) { - setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false); - } + revalidateRunnableScheduled.set(false); revalidate(); }); } @@ -5508,6 +5505,7 @@ ToolTipManager.sharedInstance().registerComponent(this); } setWriteObjCounter(this, (byte)0); + revalidateRunnableScheduled = new AtomicBoolean(false); }