Commit da032791 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Make sure the bitmap created from a packed DIB is owned by x11drv…

winex11: Make sure the bitmap created from a packed DIB is owned by x11drv before getting its pixmap.
parent d7ed2457
...@@ -4323,10 +4323,11 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc) ...@@ -4323,10 +4323,11 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc)
*/ */
Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc ) Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc )
{ {
Pixmap pixmap; Pixmap pixmap = 0;
X_PHYSBITMAP *physBitmap; X_PHYSBITMAP *physBitmap;
HBITMAP hBmp; HBITMAP hBmp;
LPBITMAPINFO pbmi; LPBITMAPINFO pbmi;
HDC memdc;
/* Create a DDB from the DIB */ /* Create a DDB from the DIB */
...@@ -4336,10 +4337,17 @@ Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc ) ...@@ -4336,10 +4337,17 @@ Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc )
pbmi, DIB_RGB_COLORS); pbmi, DIB_RGB_COLORS);
GlobalUnlock(hPackedDIB); 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 */ /* clear the physBitmap so that we can steal its pixmap */
physBitmap = X11DRV_get_phys_bitmap( hBmp ); if ((physBitmap = X11DRV_get_phys_bitmap( hBmp )))
{
pixmap = physBitmap->pixmap; pixmap = physBitmap->pixmap;
physBitmap->pixmap = 0; physBitmap->pixmap = 0;
}
/* Delete the DDB we created earlier now that we have stolen its pixmap */ /* Delete the DDB we created earlier now that we have stolen its pixmap */
DeleteObject(hBmp); DeleteObject(hBmp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment