Alexandre Julliard : winex11: Make sure the bitmap created from a packed DIB is owned by x11drv before getting its pixmap .
Alexandre Julliard
julliard at winehq.org
Thu Sep 8 14:52:10 CDT 2011
Module: wine
Branch: master
Commit: da0327917c36a428b6c5e593f156f64b9c25c0a5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=da0327917c36a428b6c5e593f156f64b9c25c0a5
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Sep 7 22:55:12 2011 +0200
winex11: Make sure the bitmap created from a packed DIB is owned by x11drv before getting its pixmap.
---
dlls/winex11.drv/dib.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index b466e69..62aea3c 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -4323,10 +4323,11 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc)
*/
Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc )
{
- Pixmap pixmap;
+ Pixmap pixmap = 0;
X_PHYSBITMAP *physBitmap;
HBITMAP hBmp;
LPBITMAPINFO pbmi;
+ HDC memdc;
/* Create a DDB from the DIB */
@@ -4336,10 +4337,17 @@ Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc )
pbmi, DIB_RGB_COLORS);
GlobalUnlock(hPackedDIB);
+ /* make sure it's owned by x11drv */
+ memdc = CreateCompatibleDC( hdc );
+ SelectObject( memdc, hBmp );
+ DeleteDC( memdc );
+
/* clear the physBitmap so that we can steal its pixmap */
- physBitmap = X11DRV_get_phys_bitmap( hBmp );
- pixmap = physBitmap->pixmap;
- physBitmap->pixmap = 0;
+ if ((physBitmap = X11DRV_get_phys_bitmap( hBmp )))
+ {
+ pixmap = physBitmap->pixmap;
+ physBitmap->pixmap = 0;
+ }
/* Delete the DDB we created earlier now that we have stolen its pixmap */
DeleteObject(hBmp);
More information about the wine-cvs
mailing list