mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-13 17:33:10 +00:00
8039097: Some tests fail with NPE since 7u60 b12
Reviewed-by: serb, alexsch
This commit is contained in:
parent
b45e2afa2a
commit
6d03ea4ffe
@ -2568,23 +2568,30 @@ public abstract class Toolkit {
|
||||
public void firePropertyChange(final PropertyChangeEvent evt) {
|
||||
Object oldValue = evt.getOldValue();
|
||||
Object newValue = evt.getNewValue();
|
||||
String propertyName = evt.getPropertyName();
|
||||
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
|
||||
return;
|
||||
}
|
||||
Runnable updater = new Runnable() {
|
||||
public void run() {
|
||||
PropertyChangeSupport pcs = (PropertyChangeSupport)
|
||||
AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
|
||||
if (null != pcs) {
|
||||
pcs.firePropertyChange(evt);
|
||||
}
|
||||
}
|
||||
};
|
||||
final AppContext currentAppContext = AppContext.getAppContext();
|
||||
for (AppContext appContext : AppContext.getAppContexts()) {
|
||||
if (null == appContext || appContext.isDisposed()) {
|
||||
continue;
|
||||
}
|
||||
final PeerEvent e = new PeerEvent(source,
|
||||
() -> {
|
||||
PropertyChangeSupport pcs = (PropertyChangeSupport)
|
||||
AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
|
||||
if (null != pcs) {
|
||||
pcs.firePropertyChange(evt);
|
||||
}
|
||||
},
|
||||
PeerEvent.ULTIMATE_PRIORITY_EVENT);
|
||||
SunToolkit.postEvent(appContext, e);
|
||||
if (currentAppContext == appContext) {
|
||||
updater.run();
|
||||
} else {
|
||||
final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
|
||||
SunToolkit.postEvent(appContext, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.awt.AWTAutoShutdown;
|
||||
import sun.awt.AWTPermissions;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.LightweightFrame;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
@ -930,7 +931,13 @@ public final class WToolkit extends SunToolkit implements Runnable {
|
||||
* Windows doesn't always send WM_SETTINGCHANGE when it should.
|
||||
*/
|
||||
private void windowsSettingChange() {
|
||||
updateProperties();
|
||||
if (AppContext.getAppContext() == null) {
|
||||
// No AppContext, so we can update properties on the current thread,
|
||||
// DesktopPropertyChangeSupport will only post events.
|
||||
updateProperties();
|
||||
} else {
|
||||
EventQueue.invokeLater(this::updateProperties);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void updateProperties() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user