Alexandre Julliard : oleaut32: Fix IPicture:: SelectPicture to not try to select a bitmap into two DCs at the same time.

Alexandre Julliard julliard at winehq.org
Fri Dec 16 11:22:54 CST 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Dec 16 16:29:12 2011 +0100

oleaut32: Fix IPicture::SelectPicture to not try to select a bitmap into two DCs at the same time.

---

 dlls/oleaut32/olepicture.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 8081785..2195ba5 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -141,6 +141,7 @@ typedef struct OLEPictureImpl {
 
     BOOL keepOrigFormat;
     HDC	hDCCur;
+    HBITMAP stock_bitmap;
 
   /* Bitmap transparency mask */
     HBITMAP hbmMask;
@@ -219,6 +220,7 @@ static void OLEPictureImpl_SetBitmap(OLEPictureImpl *This)
 
   This->himetricWidth  = xpixels_to_himetric(bm.bmWidth, hdcRef);
   This->himetricHeight = ypixels_to_himetric(bm.bmHeight, hdcRef);
+  This->stock_bitmap = GetCurrentObject( hdcRef, OBJ_BITMAP );
 
   DeleteDC(hdcRef);
 }
@@ -769,10 +771,10 @@ static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface,
   OLEPictureImpl *This = impl_from_IPicture(iface);
   TRACE("(%p)->(%p, %p, %p)\n", This, hdcIn, phdcOut, phbmpOut);
   if (This->desc.picType == PICTYPE_BITMAP) {
-      SelectObject(hdcIn,This->desc.u.bmp.hbitmap);
-
       if (phdcOut)
 	  *phdcOut = This->hDCCur;
+      if (This->hDCCur) SelectObject(This->hDCCur,This->stock_bitmap);
+      if (hdcIn) SelectObject(hdcIn,This->desc.u.bmp.hbitmap);
       This->hDCCur = hdcIn;
       if (phbmpOut)
 	  *phbmpOut = HandleToUlong(This->desc.u.bmp.hbitmap);




More information about the wine-cvs mailing list