Module: wine Branch: master Commit: 356eaa1ee2cdaf8dac75656ff878a55f5f0cd80e URL: http://source.winehq.org/git/wine.git/?a=commit;h=356eaa1ee2cdaf8dac75656ff8...
Author: Alexander Scott-Johns alexander.scott.johns@googlemail.com Date: Mon Jan 31 15:38:31 2011 +0000
winex11.drv: Improve error handling in bitmap synthesizing code.
---
dlls/winex11.drv/clipboard.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index e54e15c..3610af7 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -1060,21 +1060,23 @@ static BOOL X11DRV_CLIPBOARD_RenderSynthesizedBitmap(Display *display) if (lpSource->hData || X11DRV_CLIPBOARD_RenderFormat(display, lpSource)) { HDC hdc; - HBITMAP hData; + HBITMAP hData = NULL; unsigned int offset; LPBITMAPINFOHEADER lpbmih;
hdc = GetDC(NULL); lpbmih = GlobalLock(lpSource->hData); + if (lpbmih) + { + offset = sizeof(BITMAPINFOHEADER) + + ((lpbmih->biBitCount <= 8) ? (sizeof(RGBQUAD) * + (1 << lpbmih->biBitCount)) : 0);
- offset = sizeof(BITMAPINFOHEADER) - + ((lpbmih->biBitCount <= 8) ? (sizeof(RGBQUAD) * - (1 << lpbmih->biBitCount)) : 0); - - hData = CreateDIBitmap(hdc, lpbmih, CBM_INIT, (LPBYTE)lpbmih + - offset, (LPBITMAPINFO) lpbmih, DIB_RGB_COLORS); + hData = CreateDIBitmap(hdc, lpbmih, CBM_INIT, (LPBYTE)lpbmih + + offset, (LPBITMAPINFO) lpbmih, DIB_RGB_COLORS);
- GlobalUnlock(lpSource->hData); + GlobalUnlock(lpSource->hData); + } ReleaseDC(NULL, hdc);
if (hData)