提交 001939c4 编写于 作者: A amenkov

6999872: java.awt.Window instantiation leads to JVM CRASH on Windows, JDK7b118+ fastdebug

Reviewed-by: igor, dcherepanov
上级 394efd11
...@@ -70,7 +70,11 @@ static void EnsureJreInstallation(const char *jrepath); ...@@ -70,7 +70,11 @@ static void EnsureJreInstallation(const char *jrepath);
*/ */
#undef ENABLE_AWT_PRELOAD #undef ENABLE_AWT_PRELOAD
#ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */ #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 #endif
#ifdef ENABLE_AWT_PRELOAD #ifdef ENABLE_AWT_PRELOAD
......
...@@ -969,12 +969,15 @@ void D3DInitializer::InitImpl() ...@@ -969,12 +969,15 @@ void D3DInitializer::InitImpl()
} }
D3DPipelineManager *pMgr = D3DPipelineManager::CreateInstance(); D3DPipelineManager *pMgr = D3DPipelineManager::CreateInstance();
if (pMgr != NULL) { if (pMgr != NULL) {
UINT adapterCount = pMgr->adapterCount; // init adapters if we are preloading
if (AwtToolkit::GetInstance().GetPreloadThread().OnPreloadThread()) {
pAdapterIniters = new D3DAdapterInitializer[adapterCount]; UINT adapterCount = pMgr->adapterCount;
for (UINT i=0; i<adapterCount; i++) {
pAdapterIniters[i].setAdapter(i); pAdapterIniters = new D3DAdapterInitializer[adapterCount];
AwtToolkit::GetInstance().GetPreloadThread().AddAction(&pAdapterIniters[i]); for (UINT i=0; i<adapterCount; i++) {
pAdapterIniters[i].setAdapter(i);
AwtToolkit::GetInstance().GetPreloadThread().AddAction(&pAdapterIniters[i]);
}
} }
} }
} }
......
...@@ -1904,6 +1904,11 @@ bool AwtToolkit::PreloadThread::InvokeAndTerminate(void(_cdecl *fn)(void *), voi ...@@ -1904,6 +1904,11 @@ bool AwtToolkit::PreloadThread::InvokeAndTerminate(void(_cdecl *fn)(void *), voi
return true; return true;
} }
bool AwtToolkit::PreloadThread::OnPreloadThread()
{
return GetThreadId() == ::GetCurrentThreadId();
}
/*static*/ /*static*/
unsigned WINAPI AwtToolkit::PreloadThread::StaticThreadProc(void *param) unsigned WINAPI AwtToolkit::PreloadThread::StaticThreadProc(void *param)
{ {
......
...@@ -559,6 +559,8 @@ public: ...@@ -559,6 +559,8 @@ public:
CriticalSection::Lock lock(threadLock); CriticalSection::Lock lock(threadLock);
return wrongThread; return wrongThread;
} }
// returns true if the current thread is "preload" thread
bool OnPreloadThread();
private: private:
// data access lock // data access lock
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册