8058870: Mac: JFXPanel deadlocks in jnlp mode

Reviewed-by: serb, alexsch
This commit is contained in:
Anton Tarasov 2014-09-24 15:36:11 +04:00
parent c65f81d726
commit c8fc432f84

View File

@ -56,6 +56,7 @@ import java.io.ObjectInputStream;
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.*;
@ -354,7 +355,8 @@ public abstract class JComponent extends Container implements Serializable,
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.
@ -4901,16 +4903,11 @@ public abstract class JComponent extends Container implements Serializable,
// 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();
});
}
@ -5567,6 +5564,7 @@ public abstract class JComponent extends Container implements Serializable,
ToolTipManager.sharedInstance().registerComponent(this);
}
setWriteObjCounter(this, (byte)0);
revalidateRunnableScheduled = new AtomicBoolean(false);
}