Ensure COM is still active when Direct2D renderer is in use

Some internal D2D operations need active COM library so ensure it is properly
initialized and released in wxDirect2DModule.

Closes #17308.
This commit is contained in:
Artur Wieczorek
2015-12-30 17:41:17 +01:00
committed by Vadim Zeitlin
parent 72c47669ab
commit 450019dc21

View File

@@ -3759,7 +3759,10 @@ public:
virtual bool OnInit() wxOVERRIDE
{
return true;
HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
// RPC_E_CHANGED_MODE is not considered as an error
// - see remarks for wxOleInitialize().
return SUCCEEDED(hr) || hr == RPC_E_CHANGED_MODE;
}
virtual void OnExit() wxOVERRIDE
@@ -3781,6 +3784,8 @@ public:
delete gs_D2DRenderer;
gs_D2DRenderer = NULL;
}
::CoUninitialize();
}
private: