dib: fix deadlock

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Feb 21 06:23:05 CST 2005


        Huw Davies <huw at codeweavers.com>
        Don't hold the GDI lock when calling DC_GetDCUpdate.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/dib.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/dib.c,v
retrieving revision 1.8
diff -u -p -r1.8 dib.c
--- dlls/gdi/dib.c	14 Feb 2005 11:08:22 -0000	1.8
+++ dlls/gdi/dib.c	21 Feb 2005 12:19:22 -0000
@@ -314,12 +314,15 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP h
     BITMAPOBJ *bitmap;
     INT result = 0;
 
-    if (!(bitmap = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) return 0;
-
     if (!(dc = DC_GetDCUpdate( hdc )))
     {
         if (coloruse == DIB_RGB_COLORS) FIXME( "shouldn't require a DC for DIB_RGB_COLORS\n" );
-        GDI_ReleaseObj( hbitmap );
+        return 0;
+    }
+
+    if (!(bitmap = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
+    {
+        GDI_ReleaseObj( hdc );
         return 0;
     }
 
@@ -332,8 +335,8 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP h
         result = lines;
 
  done:
-    GDI_ReleaseObj( hdc );
     GDI_ReleaseObj( hbitmap );
+    GDI_ReleaseObj( hdc );
     return result;
 }
 



More information about the wine-patches mailing list