diff --git a/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp b/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp index a7da3f3b38c..212b912cc53 100644 --- a/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp +++ b/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp @@ -191,6 +191,14 @@ void D3DPipelineManager::NotifyAdapterEventListeners(UINT adapter, pMgr = D3DPipelineManager::GetInstance(); RETURN_IF_NULL(pMgr); hMon = pMgr->pd3d9->GetAdapterMonitor(adapter); + + /* + * If we don't have devices initialized yet, no sense to clear them. + */ + if (!Devices::GetInstance()){ + return; + } + gdiScreen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hMon); JNU_CallStaticMethodByName(env, NULL, diff --git a/jdk/src/windows/native/sun/windows/Devices.h b/jdk/src/windows/native/sun/windows/Devices.h index bbd8a497aaf..14e9e7b7f0d 100644 --- a/jdk/src/windows/native/sun/windows/Devices.h +++ b/jdk/src/windows/native/sun/windows/Devices.h @@ -36,6 +36,7 @@ class AwtWin32GraphicsDevice; class Devices { public: +static Devices* GetInstance(); static BOOL UpdateInstance(JNIEnv *env); int GetNumDevices() { return numDevices; } AwtWin32GraphicsDevice* GetDeviceReference(int index, BOOL adjust = TRUE); @@ -59,7 +60,6 @@ friend class InstanceAccess; private: Devices(int numElements); void AddReference(); -static Devices* GetInstance(); AwtWin32GraphicsDevice** devices; int refCount;