Module: wine Branch: master Commit: 630c976f8829a0a338373ca212f2e12de1c88f53 URL: http://source.winehq.org/git/wine.git/?a=commit;h=630c976f8829a0a338373ca212...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 5 18:26:18 2008 +0100
gdi32: Don't hold the GDI lock when calling DC_InitDC.
---
dlls/gdi32/bitmap.c | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index de2fdae..a873457 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -576,13 +576,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc ) BITMAPOBJ *bitmap; DC *dc;
- if (!(bitmap = GDI_GetObjPtr( handle, BITMAP_MAGIC ))) return 0; + if (!(dc = get_dc_ptr( hdc ))) return 0;
- if (!(dc = get_dc_ptr( hdc ))) - { - GDI_ReleaseObj( handle ); - return 0; - } if (GetObjectType( hdc ) != OBJ_MEMDC) { ret = 0; @@ -591,34 +586,44 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc ) ret = dc->hBitmap; if (handle == dc->hBitmap) goto done; /* nothing to do */
+ if (!(bitmap = GDI_GetObjPtr( handle, BITMAP_MAGIC ))) + { + ret = 0; + goto done; + } + if (bitmap->header.dwCount && (handle != GetStockObject(DEFAULT_BITMAP))) { WARN( "Bitmap already selected in another DC\n" ); + GDI_ReleaseObj( handle ); ret = 0; goto done; }
if (!bitmap->funcs && !BITMAP_SetOwnerDC( handle, dc )) { + GDI_ReleaseObj( handle ); ret = 0; goto done; }
- if (dc->funcs->pSelectBitmap) handle = dc->funcs->pSelectBitmap( dc->physDev, handle ); - - if (handle) + if (dc->funcs->pSelectBitmap && !dc->funcs->pSelectBitmap( dc->physDev, handle )) + { + GDI_ReleaseObj( handle ); + ret = 0; + } + else { dc->hBitmap = handle; GDI_inc_ref_count( handle ); dc->dirty = 0; SetRectRgn( dc->hVisRgn, 0, 0, bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight); + GDI_ReleaseObj( handle ); DC_InitDC( dc ); GDI_dec_ref_count( ret ); } - else ret = 0;
done: - GDI_ReleaseObj( handle ); release_dc_ptr( dc ); return ret; }