mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 09:17:14 +00:00
uxtheme: Use atomic functions for reference counting.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
This commit is contained in:
parent
113eca095a
commit
bbb5fb7e25
|
@ -171,7 +171,7 @@ HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWST
|
|||
(*tf)->pszAvailSizes = pszSizes;
|
||||
(*tf)->pszSelectedColor = pszSelectedColor;
|
||||
(*tf)->pszSelectedSize = pszSelectedSize;
|
||||
(*tf)->dwRefCount = 1;
|
||||
(*tf)->refcount = 1;
|
||||
return S_OK;
|
||||
|
||||
invalid_theme:
|
||||
|
@ -187,9 +187,12 @@ invalid_theme:
|
|||
*/
|
||||
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
|
||||
{
|
||||
LONG refcount;
|
||||
|
||||
if(tf) {
|
||||
tf->dwRefCount--;
|
||||
if(!tf->dwRefCount) {
|
||||
refcount = InterlockedDecrement(&tf->refcount);
|
||||
if (!refcount)
|
||||
{
|
||||
if(tf->hTheme) FreeLibrary(tf->hTheme);
|
||||
if(tf->classes) {
|
||||
while(tf->classes) {
|
||||
|
@ -235,7 +238,7 @@ HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf, BOOL setMetrics)
|
|||
tfActiveTheme = tf;
|
||||
if (tfActiveTheme)
|
||||
{
|
||||
tfActiveTheme->dwRefCount++;
|
||||
InterlockedIncrement(&tfActiveTheme->refcount);
|
||||
if(!tfActiveTheme->classes)
|
||||
MSSTYLES_ParseThemeIni(tfActiveTheme, setMetrics);
|
||||
}
|
||||
|
@ -1061,7 +1064,7 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, U
|
|||
if(cls) {
|
||||
TRACE("Opened app %s, class %s from list %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName), debugstr_w(pszClassList));
|
||||
cls->tf = tfActiveTheme;
|
||||
cls->tf->dwRefCount++;
|
||||
InterlockedIncrement(&cls->tf->refcount);
|
||||
InterlockedIncrement(&cls->refcount);
|
||||
cls->dpi = dpi;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef struct _THEME_IMAGE {
|
|||
} THEME_IMAGE, *PTHEME_IMAGE;
|
||||
|
||||
typedef struct _THEME_FILE {
|
||||
DWORD dwRefCount;
|
||||
LONG refcount;
|
||||
HMODULE hTheme;
|
||||
WCHAR szThemeFile[MAX_PATH];
|
||||
LPWSTR pszAvailColors;
|
||||
|
|
Loading…
Reference in a new issue