Misha Koshelev : comctl32: imagelist: Fix simultaneous selection of one bitmap into two device contexts.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 1 06:44:37 CDT 2007


Module: wine
Branch: master
Commit: fc5a746104bf8eedee25b686d9639b17d521c37a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fc5a746104bf8eedee25b686d9639b17d521c37a

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Thu May 31 23:32:41 2007 -0500

comctl32: imagelist: Fix simultaneous selection of one bitmap into two device contexts.

---

 dlls/comctl32/imagelist.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 3c9e89b..ee1ef0e 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -2563,7 +2563,7 @@ BOOL WINAPI
 ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
 {
     HDC     hdcBitmap;
-    HBITMAP hbmNewBitmap;
+    HBITMAP hbmNewBitmap, hbmOld;
     INT     nNewCount, nCopyCount;
 
     TRACE("%p %d\n",himl,iImageCount);
@@ -2588,8 +2588,9 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
 
     if (hbmNewBitmap != 0)
     {
-        SelectObject (hdcBitmap, hbmNewBitmap);
+        hbmOld = SelectObject (hdcBitmap, hbmNewBitmap);
         imagelist_copy_images( himl, himl->hdcImage, hdcBitmap, 0, nCopyCount, 0 );
+        SelectObject (hdcBitmap, hbmOld);
 
 	/* FIXME: delete 'empty' image space? */
 
@@ -2607,8 +2608,9 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
         hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
         if (hbmNewBitmap != 0)
         {
-            SelectObject (hdcBitmap, hbmNewBitmap);
+            hbmOld = SelectObject (hdcBitmap, hbmNewBitmap);
             imagelist_copy_images( himl, himl->hdcMask, hdcBitmap, 0, nCopyCount, 0 );
+            SelectObject (hdcBitmap, hbmOld);
 
 	    /* FIXME: delete 'empty' image space? */
 




More information about the wine-cvs mailing list