OpenThemeData() now always sets the window theme to the handle
returned (even if that is NULL) - previously, it could happen that when no theme was active or the theme data could not be opened that the window theme remained became then-dangling (and hence subsequent calls to GetWindowTheme() would return that bogus theme).
This commit is contained in:
parent
be5bf8022d
commit
100923508c
|
@ -324,22 +324,23 @@ HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
|
||||||
WCHAR szClassBuff[256];
|
WCHAR szClassBuff[256];
|
||||||
LPCWSTR pszAppName;
|
LPCWSTR pszAppName;
|
||||||
LPCWSTR pszUseClassList;
|
LPCWSTR pszUseClassList;
|
||||||
HTHEME hTheme;
|
HTHEME hTheme = NULL;
|
||||||
TRACE("(%p,%s)\n", hwnd, debugstr_w(pszClassList));
|
TRACE("(%p,%s)", hwnd, debugstr_w(pszClassList));
|
||||||
if(!bThemeActive)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
|
if(bThemeActive)
|
||||||
|
{
|
||||||
pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));
|
pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));
|
||||||
/* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
|
/* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
|
||||||
pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0]));
|
pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0]));
|
||||||
if(!pszUseClassList)
|
if(!pszUseClassList)
|
||||||
pszUseClassList = pszClassList;
|
pszUseClassList = pszClassList;
|
||||||
|
|
||||||
if (!pszClassList) return NULL;
|
if (pszUseClassList)
|
||||||
|
|
||||||
hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList);
|
hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList);
|
||||||
|
}
|
||||||
if(IsWindow(hwnd))
|
if(IsWindow(hwnd))
|
||||||
SetPropW(hwnd, MAKEINTATOMW(atWindowTheme), hTheme);
|
SetPropW(hwnd, MAKEINTATOMW(atWindowTheme), hTheme);
|
||||||
|
TRACE(" = %p\n", hTheme);
|
||||||
return hTheme;
|
return hTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue