summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llwindow/lldxhardware.cpp22
-rw-r--r--indra/newview/llmachineid.cpp3
2 files changed, 11 insertions, 14 deletions
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index 07856edefc..aaa2f6aef1 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -65,13 +65,12 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam)
{
HRESULT hr;
bool bGotMemory = false;
- HRESULT hrCoInitialize = S_OK;
IWbemLocator* pIWbemLocator = nullptr;
IWbemServices* pIWbemServices = nullptr;
BSTR pNamespace = nullptr;
*pdwAdapterRam = 0;
- hrCoInitialize = CoInitializeEx(0, COINIT_MULTITHREADED);
+ CoInitializeEx(0, COINIT_APARTMENTTHREADED);
hr = CoCreateInstance( CLSID_WbemLocator,
nullptr,
@@ -208,8 +207,7 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam)
SAFE_RELEASE( pIWbemLocator );
- if( SUCCEEDED( hrCoInitialize ) )
- CoUninitialize();
+ CoUninitialize();
if( bGotMemory )
return S_OK;
@@ -232,9 +230,8 @@ S32 LLDXHardware::getMBVideoMemoryViaWMI()
std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor)
{
std::string mDriverVersion;
- HRESULT hrCoInitialize = S_OK;
HRESULT hres;
- hrCoInitialize = CoInitializeEx(0, COINIT_MULTITHREADED);
+ CoInitializeEx(0, COINIT_APARTMENTTHREADED);
IWbemLocator *pLoc = NULL;
hres = CoCreateInstance(
@@ -437,10 +434,10 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor)
{
pEnumerator->Release();
}
- if (SUCCEEDED(hrCoInitialize))
- {
- CoUninitialize();
- }
+
+ // supposed to always call CoUninitialize even if init returned false
+ CoUninitialize();
+
return mDriverVersion;
}
@@ -687,7 +684,8 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
BOOL ok = FALSE;
HRESULT hr;
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ // CLSID_DxDiagProvider does not work with Multithreaded?
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
IDxDiagProvider *dx_diag_providerp = NULL;
IDxDiagContainer *dx_diag_rootp = NULL;
@@ -976,7 +974,7 @@ LLSD LLDXHardware::getDisplayInfo()
LLTimer hw_timer;
HRESULT hr;
LLSD ret;
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
IDxDiagProvider *dx_diag_providerp = NULL;
IDxDiagContainer *dx_diag_rootp = NULL;
diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp
index 8f03b13d2d..1f4418f119 100644
--- a/indra/newview/llmachineid.cpp
+++ b/indra/newview/llmachineid.cpp
@@ -85,12 +85,11 @@ void LLWMIMethods::initCOMObjects()
// Step 1: --------------------------------------------------
// Initialize COM. ------------------------------------------
- mHR = CoInitializeEx(0, COINIT_MULTITHREADED);
+ mHR = CoInitializeEx(0, COINIT_APARTMENTTHREADED);
if (FAILED(mHR))
{
// if result S_FALSE, it's already initialized
LL_DEBUGS("AppInit") << "Failed to initialize COM library. Error code = 0x" << std::hex << mHR << LL_ENDL;
- return;
}
// Step 2: --------------------------------------------------