Fix locking bug in x11drv bitblt

Jukka Heinonen jhei at iki.fi
Sun Apr 25 15:43:22 CDT 2004


It looks like x11drv has a small locking bug that causes
DIB section to be locked twice but only unlocked once.
I have not seen this bug manifest itself as I was looking
at other things when I found this bug by looking at the source. 
It looks like the bug rarely causes any real problems and this 
fix should really be carefully reviewed because the bug looks
too obvious to me.




Changelog:
  If source and destination are the same object, don't lock
  the object twice as it will only be unlocked once.




Index: dlls/x11drv/bitblt.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/bitblt.c,v
retrieving revision 1.6
diff -u -r1.6 bitblt.c
--- dlls/x11drv/bitblt.c	13 Feb 2004 20:26:27 -0000	1.6
+++ dlls/x11drv/bitblt.c	25 Apr 2004 20:32:35 -0000
@@ -1552,8 +1552,12 @@
        * we can pass TRUE instead of FALSE to CoerceDIBSection(dcDst...),
        * which may avoid a copy in some situations */
     }
+
     sDst = X11DRV_LockDIBSection( physDevDst, DIB_Status_None, FALSE );
-    sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None, FALSE );
+    if (physDevDst != physDevSrc)
+        sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None, FALSE );
+    else
+        sSrc = sDst;
 
     if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) &&
         (physDevSrc->depth == physDevDst->depth))




-- 
Jukka Heinonen <http://www.iki.fi/jhei>



More information about the wine-patches mailing list