summaryrefslogtreecommitdiff
path: root/indra/llwindow/lldxhardware.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow/lldxhardware.cpp')
-rw-r--r--indra/llwindow/lldxhardware.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index d4790f9f29..9397b831f7 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -613,6 +613,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
IDxDiagContainer *device_containerp = NULL;
IDxDiagContainer *file_containerp = NULL;
IDxDiagContainer *driver_containerp = NULL;
+ DWORD dw_device_count;
// CoCreate a IDxDiagProvider*
LL_DEBUGS("AppInit") << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL;
@@ -663,9 +664,18 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp);
if(FAILED(hr) || !devices_containerp)
{
+ // do not release 'dirty' devices_containerp at this stage, only dx_diag_rootp
+ devices_containerp = NULL;
goto LCleanup;
}
+ // make sure there is something inside
+ hr = devices_containerp->GetNumberOfChildContainers(&dw_device_count);
+ if (FAILED(hr) || dw_device_count == 0)
+ {
+ goto LCleanup;
+ }
+
// Get device 0
LL_DEBUGS("AppInit") << "devices_containerp->GetChildContainer" << LL_ENDL;
hr = devices_containerp->GetChildContainer(L"0", &device_containerp);
@@ -872,6 +882,7 @@ LLSD LLDXHardware::getDisplayInfo()
IDxDiagContainer *device_containerp = NULL;
IDxDiagContainer *file_containerp = NULL;
IDxDiagContainer *driver_containerp = NULL;
+ DWORD dw_device_count;
// CoCreate a IDxDiagProvider*
LL_INFOS() << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL;
@@ -922,9 +933,18 @@ LLSD LLDXHardware::getDisplayInfo()
hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp);
if(FAILED(hr) || !devices_containerp)
{
+ // do not release 'dirty' devices_containerp at this stage, only dx_diag_rootp
+ devices_containerp = NULL;
goto LCleanup;
}
+ // make sure there is something inside
+ hr = devices_containerp->GetNumberOfChildContainers(&dw_device_count);
+ if (FAILED(hr) || dw_device_count == 0)
+ {
+ goto LCleanup;
+ }
+
// Get device 0
LL_INFOS() << "devices_containerp->GetChildContainer" << LL_ENDL;
hr = devices_containerp->GetChildContainer(L"0", &device_containerp);
@@ -976,6 +996,10 @@ LLSD LLDXHardware::getDisplayInfo()
}
LCleanup:
+ if (ret.emptyMap())
+ {
+ LL_INFOS() << "Failed to get data, cleaning up" << LL_ENDL;
+ }
SAFE_RELEASE(file_containerp);
SAFE_RELEASE(driver_containerp);
SAFE_RELEASE(device_containerp);