Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/gdiplus/font.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index b0504b5d894..4301fa3aaa3 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -1037,7 +1037,7 @@ GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamil }
/***************************************************************************** - * GdipGetGenericFontFamilySansSerif [GDIPLUS.@] + * GdipNewPrivateFontCollection [GDIPLUS.@] */ GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection** fontCollection) {
Signed-off-by: Jeff Smith whydoubt@gmail.com --- Without this GdipNewInstalledFontCollection may return a partial collection, if called while another thread is initializing it.
dlls/gdiplus/font.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 4301fa3aaa3..05663b71aad 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -117,6 +117,15 @@ typedef struct
static GpFontCollection installedFontCollection = {0};
+static CRITICAL_SECTION font_cs; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &font_cs, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": font_cs") } +}; +static CRITICAL_SECTION font_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; + /******************************************************************************* * GdipCreateFont [GDIPLUS.@] * @@ -1648,6 +1657,7 @@ GpStatus WINGDIPAPI GdipNewInstalledFontCollection( if (!fontCollection) return InvalidParameter;
+ EnterCriticalSection( &font_cs ); if (installedFontCollection.count == 0) { struct add_font_param param; @@ -1665,11 +1675,13 @@ GpStatus WINGDIPAPI GdipNewInstalledFontCollection( { free_installed_fonts(); DeleteDC(param.hdc); + LeaveCriticalSection( &font_cs ); return param.stat; }
DeleteDC(param.hdc); } + LeaveCriticalSection( &font_cs );
*fontCollection = &installedFontCollection;
Signed-off-by: Esme Povirk esme@codeweavers.com