mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00
[NTGDI][FREETYPE] Fix FontLink freeze (#7063)
#7009 introduced unexpected freezing on gdi* bot tests. JIRA issue: CORE-19667 Fix the locking-related assertions by adding/removing lock/unlock.
This commit is contained in:
parent
0f9e889736
commit
a207a3c931
1 changed files with 20 additions and 5 deletions
|
@ -832,12 +832,18 @@ VOID DumpPrivateFontList(BOOL bDoLock)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bDoLock)
|
if (bDoLock)
|
||||||
|
{
|
||||||
|
IntLockFreeType();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
|
}
|
||||||
|
|
||||||
DumpFontList(&Win32Process->PrivateFontListHead);
|
DumpFontList(&Win32Process->PrivateFontListHead);
|
||||||
|
|
||||||
if (bDoLock)
|
if (bDoLock)
|
||||||
|
{
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DumpGlobalFontList(BOOL bDoLock)
|
VOID DumpGlobalFontList(BOOL bDoLock)
|
||||||
|
@ -1961,6 +1967,7 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
|
||||||
Entry->Font = FontGDI;
|
Entry->Font = FontGDI;
|
||||||
Entry->NotEnum = (Characteristics & FR_NOT_ENUM);
|
Entry->NotEnum = (Characteristics & FR_NOT_ENUM);
|
||||||
|
|
||||||
|
IntLockFreeType();
|
||||||
if (Characteristics & FR_PRIVATE)
|
if (Characteristics & FR_PRIVATE)
|
||||||
{
|
{
|
||||||
/* private font */
|
/* private font */
|
||||||
|
@ -1972,10 +1979,9 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* global font */
|
/* global font */
|
||||||
IntLockFreeType();
|
|
||||||
InsertTailList(&g_FontListHead, &Entry->ListEntry);
|
InsertTailList(&g_FontListHead, &Entry->ListEntry);
|
||||||
IntUnLockFreeType();
|
|
||||||
}
|
}
|
||||||
|
IntUnLockFreeType();
|
||||||
|
|
||||||
if (FontIndex == -1)
|
if (FontIndex == -1)
|
||||||
{
|
{
|
||||||
|
@ -2485,10 +2491,12 @@ IntGdiAddFontMemResource(PVOID Buffer, DWORD dwSize, PDWORD pNumAdded)
|
||||||
{
|
{
|
||||||
PPROCESSINFO Win32Process = PsGetCurrentProcessWin32Process();
|
PPROCESSINFO Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
EntryCollection->Entry = LoadFont.PrivateEntry;
|
EntryCollection->Entry = LoadFont.PrivateEntry;
|
||||||
|
IntLockFreeType();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
|
EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
|
||||||
InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
|
InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
Ret = EntryCollection->Handle;
|
Ret = EntryCollection->Handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2543,6 +2551,7 @@ IntGdiRemoveFontMemResource(HANDLE hMMFont)
|
||||||
PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
|
PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
|
||||||
PPROCESSINFO Win32Process = PsGetCurrentProcessWin32Process();
|
PPROCESSINFO Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
|
|
||||||
|
IntLockFreeType();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
for (Entry = Win32Process->PrivateMemFontListHead.Flink;
|
for (Entry = Win32Process->PrivateMemFontListHead.Flink;
|
||||||
Entry != &Win32Process->PrivateMemFontListHead;
|
Entry != &Win32Process->PrivateMemFontListHead;
|
||||||
|
@ -2558,6 +2567,7 @@ IntGdiRemoveFontMemResource(HANDLE hMMFont)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
|
|
||||||
if (EntryCollection)
|
if (EntryCollection)
|
||||||
{
|
{
|
||||||
|
@ -2581,6 +2591,7 @@ IntGdiCleanupPrivateFontsForProcess(VOID)
|
||||||
Entry = NULL;
|
Entry = NULL;
|
||||||
EntryCollection = NULL;
|
EntryCollection = NULL;
|
||||||
|
|
||||||
|
IntLockFreeType();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
|
if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
|
||||||
{
|
{
|
||||||
|
@ -2589,6 +2600,7 @@ IntGdiCleanupPrivateFontsForProcess(VOID)
|
||||||
UnlinkFontMemCollection(EntryCollection);
|
UnlinkFontMemCollection(EntryCollection);
|
||||||
}
|
}
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
|
|
||||||
if (EntryCollection)
|
if (EntryCollection)
|
||||||
{
|
{
|
||||||
|
@ -2599,12 +2611,14 @@ IntGdiCleanupPrivateFontsForProcess(VOID)
|
||||||
{
|
{
|
||||||
/* No Mem fonts anymore, see if we have any other private fonts left */
|
/* No Mem fonts anymore, see if we have any other private fonts left */
|
||||||
Entry = NULL;
|
Entry = NULL;
|
||||||
|
IntLockFreeType();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
if (!IsListEmpty(&Win32Process->PrivateFontListHead))
|
if (!IsListEmpty(&Win32Process->PrivateFontListHead))
|
||||||
{
|
{
|
||||||
Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
|
Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
|
||||||
}
|
}
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
|
|
||||||
if (Entry)
|
if (Entry)
|
||||||
{
|
{
|
||||||
|
@ -3720,13 +3734,13 @@ GetFontFamilyInfoForSubstitutes(const LOGFONTW *LogFont,
|
||||||
/* search in global fonts */
|
/* search in global fonts */
|
||||||
IntLockFreeType();
|
IntLockFreeType();
|
||||||
GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount, &g_FontListHead);
|
GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount, &g_FontListHead);
|
||||||
IntUnLockFreeType();
|
|
||||||
|
|
||||||
/* search in private fonts */
|
/* search in private fonts */
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount,
|
GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount,
|
||||||
&Win32Process->PrivateFontListHead);
|
&Win32Process->PrivateFontListHead);
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
|
|
||||||
if (LogFont->lfFaceName[0] != UNICODE_NULL)
|
if (LogFont->lfFaceName[0] != UNICODE_NULL)
|
||||||
{
|
{
|
||||||
|
@ -5930,13 +5944,13 @@ TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
|
||||||
Win32Process = PsGetCurrentProcessWin32Process();
|
Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
|
|
||||||
/* Search private fonts */
|
/* Search private fonts */
|
||||||
|
IntLockFreeType();
|
||||||
IntLockProcessPrivateFonts(Win32Process);
|
IntLockProcessPrivateFonts(Win32Process);
|
||||||
FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
|
FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
|
||||||
&Win32Process->PrivateFontListHead);
|
&Win32Process->PrivateFontListHead);
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
|
||||||
/* Search system fonts */
|
/* Search system fonts */
|
||||||
IntLockFreeType();
|
|
||||||
FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
|
FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
|
||||||
&g_FontListHead);
|
&g_FontListHead);
|
||||||
IntUnLockFreeType();
|
IntUnLockFreeType();
|
||||||
|
@ -6431,7 +6445,6 @@ IntGetFontFamilyInfo(HDC Dc,
|
||||||
IntUnLockFreeType();
|
IntUnLockFreeType();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
IntUnLockFreeType();
|
|
||||||
|
|
||||||
/* Enumerate font families in the process local list */
|
/* Enumerate font families in the process local list */
|
||||||
Win32Process = PsGetCurrentProcessWin32Process();
|
Win32Process = PsGetCurrentProcessWin32Process();
|
||||||
|
@ -6440,9 +6453,11 @@ IntGetFontFamilyInfo(HDC Dc,
|
||||||
&Win32Process->PrivateFontListHead))
|
&Win32Process->PrivateFontListHead))
|
||||||
{
|
{
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
IntUnLockProcessPrivateFonts(Win32Process);
|
IntUnLockProcessPrivateFonts(Win32Process);
|
||||||
|
IntUnLockFreeType();
|
||||||
|
|
||||||
/* Enumerate font families in the registry */
|
/* Enumerate font families in the registry */
|
||||||
if (!GetFontFamilyInfoForSubstitutes(SafeLogFont, SafeInfo, &AvailCount, InfoCount))
|
if (!GetFontFamilyInfoForSubstitutes(SafeLogFont, SafeInfo, &AvailCount, InfoCount))
|
||||||
|
|
Loading…
Reference in a new issue