mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 19:43:38 +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)->pszAvailSizes = pszSizes;
|
||||||
(*tf)->pszSelectedColor = pszSelectedColor;
|
(*tf)->pszSelectedColor = pszSelectedColor;
|
||||||
(*tf)->pszSelectedSize = pszSelectedSize;
|
(*tf)->pszSelectedSize = pszSelectedSize;
|
||||||
(*tf)->dwRefCount = 1;
|
(*tf)->refcount = 1;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
invalid_theme:
|
invalid_theme:
|
||||||
|
@ -187,9 +187,12 @@ invalid_theme:
|
||||||
*/
|
*/
|
||||||
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
|
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
|
||||||
{
|
{
|
||||||
|
LONG refcount;
|
||||||
|
|
||||||
if(tf) {
|
if(tf) {
|
||||||
tf->dwRefCount--;
|
refcount = InterlockedDecrement(&tf->refcount);
|
||||||
if(!tf->dwRefCount) {
|
if (!refcount)
|
||||||
|
{
|
||||||
if(tf->hTheme) FreeLibrary(tf->hTheme);
|
if(tf->hTheme) FreeLibrary(tf->hTheme);
|
||||||
if(tf->classes) {
|
if(tf->classes) {
|
||||||
while(tf->classes) {
|
while(tf->classes) {
|
||||||
|
@ -235,7 +238,7 @@ HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf, BOOL setMetrics)
|
||||||
tfActiveTheme = tf;
|
tfActiveTheme = tf;
|
||||||
if (tfActiveTheme)
|
if (tfActiveTheme)
|
||||||
{
|
{
|
||||||
tfActiveTheme->dwRefCount++;
|
InterlockedIncrement(&tfActiveTheme->refcount);
|
||||||
if(!tfActiveTheme->classes)
|
if(!tfActiveTheme->classes)
|
||||||
MSSTYLES_ParseThemeIni(tfActiveTheme, setMetrics);
|
MSSTYLES_ParseThemeIni(tfActiveTheme, setMetrics);
|
||||||
}
|
}
|
||||||
|
@ -1061,7 +1064,7 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, U
|
||||||
if(cls) {
|
if(cls) {
|
||||||
TRACE("Opened app %s, class %s from list %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName), debugstr_w(pszClassList));
|
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 = tfActiveTheme;
|
||||||
cls->tf->dwRefCount++;
|
InterlockedIncrement(&cls->tf->refcount);
|
||||||
InterlockedIncrement(&cls->refcount);
|
InterlockedIncrement(&cls->refcount);
|
||||||
cls->dpi = dpi;
|
cls->dpi = dpi;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ typedef struct _THEME_IMAGE {
|
||||||
} THEME_IMAGE, *PTHEME_IMAGE;
|
} THEME_IMAGE, *PTHEME_IMAGE;
|
||||||
|
|
||||||
typedef struct _THEME_FILE {
|
typedef struct _THEME_FILE {
|
||||||
DWORD dwRefCount;
|
LONG refcount;
|
||||||
HMODULE hTheme;
|
HMODULE hTheme;
|
||||||
WCHAR szThemeFile[MAX_PATH];
|
WCHAR szThemeFile[MAX_PATH];
|
||||||
LPWSTR pszAvailColors;
|
LPWSTR pszAvailColors;
|
||||||
|
|
Loading…
Reference in a new issue