diff --git a/dlls/dxdiagn/container.c b/dlls/dxdiagn/container.c index 96ba10a179c..6de641f6f93 100644 --- a/dlls/dxdiagn/container.c +++ b/dlls/dxdiagn/container.c @@ -222,10 +222,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_GetProp(PDXDIAGCONTAINER iface, LPCWS LIST_FOR_EACH_ENTRY(p, &This->cont->properties, IDxDiagContainerImpl_Property, entry) { if (0 == lstrcmpW(p->propName, pwszPropName)) { - HRESULT hr = VariantClear(pvarProp); - if (hr == DISP_E_ARRAYISLOCKED || hr == DISP_E_BADVARTYPE) - VariantInit(pvarProp); - + VariantInit(pvarProp); return VariantCopy(pvarProp, &p->vProp); } } diff --git a/dlls/dxdiagn/tests/container.c b/dlls/dxdiagn/tests/container.c index c7bd2bb2ed6..dff8701bc37 100644 --- a/dlls/dxdiagn/tests/container.c +++ b/dlls/dxdiagn/tests/container.c @@ -568,6 +568,7 @@ static void test_GetProp(void) VARIANT var; SAFEARRAY *sa; SAFEARRAYBOUND bound; + ULONG ref; static const WCHAR emptyW[] = {0}; static const WCHAR testW[] = {'t','e','s','t',0}; @@ -680,8 +681,21 @@ static void test_GetProp(void) ok(hr == S_OK, "Expected SafeArrayUnlock to return S_OK, got 0x%08x\n", hr); hr = SafeArrayDestroy(sa); ok(hr == S_OK, "Expected SafeArrayDestroy to return S_OK, got 0x%08x\n", hr); - IDxDiagContainer_Release(child); + /* Determine whether GetProp calls VariantClear on the passed variant. */ + V_VT(&var) = VT_UNKNOWN; + V_UNKNOWN(&var) = (IUnknown *)child; + IDxDiagContainer_AddRef(child); + + hr = IDxDiagContainer_GetProp(child, property, &var); + ok(hr == S_OK, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr); + ok(V_VT(&var) != VT_UNKNOWN, "Expected the variant to be modified\n"); + + IDxDiagContainer_AddRef(child); + ref = IDxDiagContainer_Release(child); + ok(ref == 2, "Expected reference count to be 2, got %u\n", ref); + + IDxDiagContainer_Release(child); cleanup: IDxDiagContainer_Release(pddc); IDxDiagProvider_Release(pddp);