Mercurial > hg > release > icedtea7-forest-2.6 > jdk
changeset 8061:07fc91c550da jdk7u66-b15
Merge
author | asaha |
---|---|
date | Mon, 02 Jun 2014 12:13:46 -0700 |
parents | e5ed4a6ba4ae (current diff) 8cff6ce00a91 (diff) |
children | e0f247ce3b2e |
files | |
diffstat | 3 files changed, 35 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/windows/classes/sun/awt/windows/ThemeReader.java Wed May 28 09:51:39 2014 -0700 +++ b/src/windows/classes/sun/awt/windows/ThemeReader.java Mon Jun 02 12:13:46 2014 -0700 @@ -56,18 +56,12 @@ new ReentrantReadWriteLock(); private static final Lock readLock = readWriteLock.readLock(); private static final Lock writeLock = readWriteLock.writeLock(); + private static volatile boolean valid = false; static void flush() { - writeLock.lock(); - try { - // Close old themes. - for (Long value : widgetToTheme.values()) { - closeTheme(value.longValue()); - } - widgetToTheme.clear(); - } finally { - writeLock.unlock(); - } + // Could be called on Toolkit thread, so do not try to aquire locks + // to avoid deadlock with theme initialization + valid = false; } public native static boolean isThemed(); @@ -94,6 +88,24 @@ // returns theme value // this method should be invoked with readLock locked private static Long getTheme(String widget) { + if (!valid) { + readLock.unlock(); + writeLock.lock(); + try { + if (!valid) { + // Close old themes. + for (Long value : widgetToTheme.values()) { + closeTheme(value); + } + widgetToTheme.clear(); + valid = true; + } + } finally { + readLock.lock(); + writeLock.unlock(); + } + } + // mostly copied from the javadoc for ReentrantReadWriteLock Long theme = widgetToTheme.get(widget); if (theme == null) {
--- a/src/windows/classes/sun/awt/windows/WToolkit.java Wed May 28 09:51:39 2014 -0700 +++ b/src/windows/classes/sun/awt/windows/WToolkit.java Mon Jun 02 12:13:46 2014 -0700 @@ -864,12 +864,18 @@ * Windows doesn't always send WM_SETTINGCHANGE when it should. */ private void windowsSettingChange() { - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - updateProperties(); - } - }); + if (AppContext.getAppContext() == null) { + // We cannot post the update to any EventQueue. Listeners will + // be called on EDTs by DesktopPropertyChangeSupport + updateProperties(); + } else { + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + updateProperties(); + } + }); + } } private synchronized void updateProperties() {
--- a/src/windows/classes/sun/awt/windows/WWindowPeer.java Wed May 28 09:51:39 2014 -0700 +++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java Mon Jun 02 12:13:46 2014 -0700 @@ -421,6 +421,7 @@ */ public static long[] getActiveWindowHandles() { AppContext appContext = AppContext.getAppContext(); + if (appContext == null) return null; synchronized (appContext) { List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY); if (l == null) {