diff options
| author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-09-19 14:54:55 +0300 | 
|---|---|---|
| committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-09-19 14:54:55 +0300 | 
| commit | 7829b4d3f46ff21d1d932b06f4721760ebbde014 (patch) | |
| tree | 1fdc5ed0fcde98bd40cbae057e66ae7e98df187e /indra/llwindow | |
| parent | 246db89a939d7965feb234600bcbd07860871351 (diff) | |
SL-3221 Safeguard against crashes in LLDXHardware
Diffstat (limited to 'indra/llwindow')
| -rw-r--r-- | indra/llwindow/lldxhardware.cpp | 24 | 
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); | 
