Jeff Smith : gdiplus: Guard initialization of installed font collection.

Alexandre Julliard julliard at winehq.org
Mon Nov 23 15:43:23 CST 2020


Module: wine
Branch: master
Commit: 6aea9b9d7723d335f30b657ec334897bf8bec8be
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6aea9b9d7723d335f30b657ec334897bf8bec8be

Author: Jeff Smith <whydoubt at gmail.com>
Date:   Thu Nov 19 10:35:57 2020 -0600

gdiplus: Guard initialization of installed font collection.

Signed-off-by: Jeff Smith <whydoubt at gmail.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
 




More information about the wine-cvs mailing list