[PATCH] Remove potential reference count races.

max at mtew.isa-geek.net max at mtew.isa-geek.net
Sat Oct 27 20:59:19 CDT 2012


From: Max TenEyck Woodbury <max at mtew.isa-geek.net>

---
 dlls/gdi32/freetype.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 6af977c..3379c6e 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -3820,7 +3820,7 @@ static struct font_mapping *map_font_file( const char *name )
     {
         if (mapping->dev == st.st_dev && mapping->ino == st.st_ino)
         {
-            mapping->refcount++;
+            InterlockedIncrement(&mapping->refcount);
             close( fd );
             return mapping;
         }
@@ -3850,7 +3850,7 @@ error:
 
 static void unmap_font_file( struct font_mapping *mapping )
 {
-    if (!--mapping->refcount)
+    if (!InterlockedDecrement(&mapping->refcount))
     {
         list_remove( &mapping->entry );
         munmap( mapping->data, mapping->size );
-- 
1.7.7.6




More information about the wine-patches mailing list