[SHELL32] Fix property sheets that can't be closed due to failed init (#4709)

When a PropertySheet fails to init, that fact is being logged
and it shows an empty page, but it can't be closed.

Handle second failure properly by using FAILED_UNEXPECTEDLY macro.

CORE-18333
This commit is contained in:
Kyle Katarn 2022-09-19 03:06:47 +02:00 committed by GitHub
parent 456f9f96e7
commit 32c20ab112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,13 +132,20 @@ SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CH
{
pFileDefExt->AddRef(); // CreateInstance returns object with 0 ref count
hr = pFileDefExt->Initialize(pidlFolder, pDataObj, NULL);
if (SUCCEEDED(hr))
if (!FAILED_UNEXPECTEDLY(hr))
{
hr = pFileDefExt->AddPages(AddPropSheetPageCallback, (LPARAM)&Header);
if (FAILED(hr))
if (FAILED_UNEXPECTEDLY(hr))
{
ERR("AddPages failed\n");
} else
return FALSE;
}
}
else
{
ERR("Initialize failed\n");
return FALSE;
}
}
LoadPropSheetHandlers(wszPath, &Header, MAX_PROPERTY_SHEET_PAGE - 1, hpsxa, pDataObj);