From fc5a746104bf8eedee25b686d9639b17d521c37a Mon Sep 17 00:00:00 2001 From: Misha Koshelev Date: Thu, 31 May 2007 23:32:41 -0500 Subject: [PATCH] comctl32: imagelist: Fix simultaneous selection of one bitmap into two device contexts. --- dlls/comctl32/imagelist.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 3c9e89b2994..ee1ef0e0fa5 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? */ -- 2.11.4.GIT