OpenJDK / jigsaw / jake / jdk
changeset 3090:9461aeec7d9c
6999872: java.awt.Window instantiation leads to JVM CRASH on Windows, JDK7b118+ fastdebug
Reviewed-by: igor, dcherepanov
author | amenkov |
---|---|
date | Thu, 25 Nov 2010 15:58:11 +0300 |
parents | f5708f506523 |
children | 5ae935cdc84d |
files | src/windows/bin/java_md.c src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp src/windows/native/sun/windows/awt_Toolkit.cpp src/windows/native/sun/windows/awt_Toolkit.h |
diffstat | 4 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/windows/bin/java_md.c Wed Nov 24 15:26:41 2010 -0800 +++ b/src/windows/bin/java_md.c Thu Nov 25 15:58:11 2010 +0300 @@ -70,7 +70,11 @@ */ #undef ENABLE_AWT_PRELOAD #ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */ - #define ENABLE_AWT_PRELOAD + /* CR6999872: fastdebug crashes if awt library is loaded before JVM is + * initialized*/ + #if !defined(DEBUG) + #define ENABLE_AWT_PRELOAD + #endif #endif #ifdef ENABLE_AWT_PRELOAD
--- a/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp Wed Nov 24 15:26:41 2010 -0800 +++ b/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp Thu Nov 25 15:58:11 2010 +0300 @@ -969,12 +969,15 @@ } D3DPipelineManager *pMgr = D3DPipelineManager::CreateInstance(); if (pMgr != NULL) { - UINT adapterCount = pMgr->adapterCount; + // init adapters if we are preloading + if (AwtToolkit::GetInstance().GetPreloadThread().OnPreloadThread()) { + UINT adapterCount = pMgr->adapterCount; - pAdapterIniters = new D3DAdapterInitializer[adapterCount]; - for (UINT i=0; i<adapterCount; i++) { - pAdapterIniters[i].setAdapter(i); - AwtToolkit::GetInstance().GetPreloadThread().AddAction(&pAdapterIniters[i]); + pAdapterIniters = new D3DAdapterInitializer[adapterCount]; + for (UINT i=0; i<adapterCount; i++) { + pAdapterIniters[i].setAdapter(i); + AwtToolkit::GetInstance().GetPreloadThread().AddAction(&pAdapterIniters[i]); + } } } }
--- a/src/windows/native/sun/windows/awt_Toolkit.cpp Wed Nov 24 15:26:41 2010 -0800 +++ b/src/windows/native/sun/windows/awt_Toolkit.cpp Thu Nov 25 15:58:11 2010 +0300 @@ -1904,6 +1904,11 @@ return true; } +bool AwtToolkit::PreloadThread::OnPreloadThread() +{ + return GetThreadId() == ::GetCurrentThreadId(); +} + /*static*/ unsigned WINAPI AwtToolkit::PreloadThread::StaticThreadProc(void *param) {
--- a/src/windows/native/sun/windows/awt_Toolkit.h Wed Nov 24 15:26:41 2010 -0800 +++ b/src/windows/native/sun/windows/awt_Toolkit.h Thu Nov 25 15:58:11 2010 +0300 @@ -559,6 +559,8 @@ CriticalSection::Lock lock(threadLock); return wrongThread; } + // returns true if the current thread is "preload" thread + bool OnPreloadThread(); private: // data access lock