[1/9] gdiplus: Make sure that GdipBitmapLockBits stores valid lockmode.

Dmitry Timoshkov dmitry at baikal.ru
Mon Jul 16 01:40:15 CDT 2012


When flags 0 are passed to GdipBitmapLockBits then GdipBitmapUnlockBits
thinks that a bitmap is not locked and fails. Adding ImageLockModeRead to
stored flags changes nothing in GdipBitmapUnlockBits logic and makes sure
that bitmap->lockmode is not 0.

This patch replaces
"gdiplus: GdipBitmapLockBits should treat flags == 0 as ImageLockModeRead."
---
 dlls/gdiplus/image.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 9b36280..34e5683 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -953,7 +953,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
         lockeddata->Scan0 = bitmap->bits + (bitspp / 8) * act_rect.X +
                             bitmap->stride * act_rect.Y;
 
-        bitmap->lockmode = flags;
+        bitmap->lockmode = flags | ImageLockModeRead;
         bitmap->numlocks++;
 
         return Ok;
@@ -1022,7 +1022,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
         }
     }
 
-    bitmap->lockmode = flags;
+    bitmap->lockmode = flags | ImageLockModeRead;
     bitmap->numlocks++;
     bitmap->lockx = act_rect.X;
     bitmap->locky = act_rect.Y;
-- 
1.7.11.2




More information about the wine-patches mailing list