mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
gdi32: Don't hold the GDI lock while calling the DeleteObject method for GDI objects.
This commit is contained in:
parent
b4255d295d
commit
f03871094c
@ -35,7 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(bitmap);
|
||||
|
||||
static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc );
|
||||
static INT BITMAP_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
static BOOL BITMAP_DeleteObject( HGDIOBJ handle, void *obj );
|
||||
static BOOL BITMAP_DeleteObject( HGDIOBJ handle );
|
||||
|
||||
static const struct gdi_obj_funcs bitmap_funcs =
|
||||
{
|
||||
@ -624,9 +624,11 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
|
||||
/***********************************************************************
|
||||
* BITMAP_DeleteObject
|
||||
*/
|
||||
static BOOL BITMAP_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
BITMAPOBJ * bmp = obj;
|
||||
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, BITMAP_MAGIC );
|
||||
|
||||
if (!bmp) return FALSE;
|
||||
|
||||
if (bmp->funcs && bmp->funcs->pDeleteBitmap)
|
||||
bmp->funcs->pDeleteBitmap( handle );
|
||||
@ -661,7 +663,7 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, bmp->color_table);
|
||||
}
|
||||
return GDI_FreeObject( handle, obj );
|
||||
return GDI_FreeObject( handle, bmp );
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ typedef struct
|
||||
|
||||
static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc );
|
||||
static INT BRUSH_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
static BOOL BRUSH_DeleteObject( HGDIOBJ handle, void *obj );
|
||||
static BOOL BRUSH_DeleteObject( HGDIOBJ handle );
|
||||
|
||||
static const struct gdi_obj_funcs brush_funcs =
|
||||
{
|
||||
@ -405,10 +405,11 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
|
||||
/***********************************************************************
|
||||
* BRUSH_DeleteObject
|
||||
*/
|
||||
static BOOL BRUSH_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
BRUSHOBJ *brush = obj;
|
||||
BRUSHOBJ *brush = GDI_GetObjPtr( handle, BRUSH_MAGIC );
|
||||
|
||||
if (!brush) return FALSE;
|
||||
switch(brush->logbrush.lbStyle)
|
||||
{
|
||||
case BS_PATTERN:
|
||||
@ -418,7 +419,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
GlobalFree16( (HGLOBAL16)brush->logbrush.lbHatch );
|
||||
break;
|
||||
}
|
||||
return GDI_FreeObject( handle, obj );
|
||||
return GDI_FreeObject( handle, brush );
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dc);
|
||||
|
||||
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
|
||||
|
||||
static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj );
|
||||
static BOOL DC_DeleteObject( HGDIOBJ handle );
|
||||
|
||||
static const struct gdi_obj_funcs dc_funcs =
|
||||
{
|
||||
@ -224,9 +224,8 @@ void update_dc( DC *dc )
|
||||
/***********************************************************************
|
||||
* DC_DeleteObject
|
||||
*/
|
||||
static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
static BOOL DC_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
GDI_ReleaseObj( handle );
|
||||
return DeleteDC( handle );
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ static inline INT INTERNAL_YWSTODS(DC *dc, INT height)
|
||||
static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc );
|
||||
static INT FONT_GetObjectA( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
static INT FONT_GetObjectW( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
static BOOL FONT_DeleteObject( HGDIOBJ handle, void *obj );
|
||||
static BOOL FONT_DeleteObject( HGDIOBJ handle );
|
||||
|
||||
static const struct gdi_obj_funcs font_funcs =
|
||||
{
|
||||
@ -545,8 +545,10 @@ static INT FONT_GetObjectW( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
|
||||
/***********************************************************************
|
||||
* FONT_DeleteObject
|
||||
*/
|
||||
static BOOL FONT_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
static BOOL FONT_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
FONTOBJ *obj = GDI_GetObjPtr( handle, FONT_MAGIC ); /* to grab the GDI lock (FIXME) */
|
||||
if (!obj) return FALSE;
|
||||
WineEngDestroyFontInstance( handle );
|
||||
return GDI_FreeObject( handle, obj );
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ struct gdi_obj_funcs
|
||||
INT (*pGetObjectA)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
INT (*pGetObjectW)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
BOOL (*pUnrealizeObject)( HGDIOBJ handle, void *obj );
|
||||
BOOL (*pDeleteObject)( HGDIOBJ handle, void *obj );
|
||||
BOOL (*pDeleteObject)( HGDIOBJ handle );
|
||||
};
|
||||
|
||||
struct hdc_list
|
||||
|
@ -809,7 +809,9 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
|
||||
/* Check if object is valid */
|
||||
|
||||
struct hdc_list *hdcs_head;
|
||||
const struct gdi_obj_funcs *funcs;
|
||||
GDIOBJHDR * header;
|
||||
|
||||
if (HIWORD(obj)) return FALSE;
|
||||
|
||||
if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
|
||||
@ -855,11 +857,12 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
|
||||
|
||||
/* Delete object */
|
||||
|
||||
if (header->funcs && header->funcs->pDeleteObject)
|
||||
return header->funcs->pDeleteObject( obj, header );
|
||||
|
||||
funcs = header->funcs;
|
||||
GDI_ReleaseObj( obj );
|
||||
return FALSE;
|
||||
if (funcs && funcs->pDeleteObject)
|
||||
return funcs->pDeleteObject( obj );
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -47,7 +47,7 @@ typedef struct tagPALETTEOBJ
|
||||
|
||||
static INT PALETTE_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
static BOOL PALETTE_UnrealizeObject( HGDIOBJ handle, void *obj );
|
||||
static BOOL PALETTE_DeleteObject( HGDIOBJ handle, void *obj );
|
||||
static BOOL PALETTE_DeleteObject( HGDIOBJ handle );
|
||||
|
||||
static const struct gdi_obj_funcs palette_funcs =
|
||||
{
|
||||
@ -668,8 +668,11 @@ static BOOL PALETTE_UnrealizeObject( HGDIOBJ handle, void *obj )
|
||||
/***********************************************************************
|
||||
* PALETTE_DeleteObject
|
||||
*/
|
||||
static BOOL PALETTE_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
PALETTEOBJ *obj = GDI_GetObjPtr( handle, PALETTE_MAGIC );
|
||||
|
||||
if (!obj) return FALSE;
|
||||
PALETTE_UnrealizeObject( handle, obj );
|
||||
return GDI_FreeObject( handle, obj );
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ typedef struct
|
||||
|
||||
static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc );
|
||||
static INT PEN_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
|
||||
static BOOL PEN_DeleteObject( HGDIOBJ handle );
|
||||
|
||||
static const struct gdi_obj_funcs pen_funcs =
|
||||
{
|
||||
@ -50,7 +51,7 @@ static const struct gdi_obj_funcs pen_funcs =
|
||||
PEN_GetObject, /* pGetObjectA */
|
||||
PEN_GetObject, /* pGetObjectW */
|
||||
NULL, /* pUnrealizeObject */
|
||||
GDI_FreeObject /* pDeleteObject */
|
||||
PEN_DeleteObject /* pDeleteObject */
|
||||
};
|
||||
|
||||
|
||||
@ -250,6 +251,18 @@ static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PEN_DeleteObject
|
||||
*/
|
||||
static BOOL PEN_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
PENOBJ *pen = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
|
||||
|
||||
if (!pen) return FALSE;
|
||||
return GDI_FreeObject( handle, pen );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PEN_GetObject
|
||||
*/
|
||||
|
@ -121,7 +121,7 @@ typedef struct
|
||||
|
||||
|
||||
static HGDIOBJ REGION_SelectObject( HGDIOBJ handle, HDC hdc );
|
||||
static BOOL REGION_DeleteObject( HGDIOBJ handle, void *obj );
|
||||
static BOOL REGION_DeleteObject( HGDIOBJ handle );
|
||||
|
||||
static const struct gdi_obj_funcs region_funcs =
|
||||
{
|
||||
@ -535,14 +535,13 @@ static void REGION_DestroyWineRegion( WINEREGION* pReg )
|
||||
/***********************************************************************
|
||||
* REGION_DeleteObject
|
||||
*/
|
||||
static BOOL REGION_DeleteObject( HGDIOBJ handle, void *obj )
|
||||
static BOOL REGION_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
RGNOBJ *rgn = obj;
|
||||
|
||||
TRACE(" %p\n", handle );
|
||||
RGNOBJ *rgn = GDI_GetObjPtr( handle, REGION_MAGIC );
|
||||
|
||||
if (!rgn) return FALSE;
|
||||
REGION_DestroyWineRegion( rgn->rgn );
|
||||
return GDI_FreeObject( handle, obj );
|
||||
return GDI_FreeObject( handle, rgn );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -2815,7 +2814,8 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
|
||||
total += Count[poly];
|
||||
if (! (pETEs = HeapAlloc( GetProcessHeap(), 0, sizeof(EdgeTableEntry) * total )))
|
||||
{
|
||||
REGION_DeleteObject( hrgn, obj );
|
||||
REGION_DestroyWineRegion( region );
|
||||
GDI_FreeObject( hrgn, obj );
|
||||
return 0;
|
||||
}
|
||||
pts = FirstPtBlock.pts;
|
||||
@ -2905,7 +2905,8 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
|
||||
sizeof(POINTBLOCK) );
|
||||
if(!tmpPtBlock) {
|
||||
WARN("Can't alloc tPB\n");
|
||||
REGION_DeleteObject( hrgn, obj );
|
||||
REGION_DestroyWineRegion( region );
|
||||
GDI_FreeObject( hrgn, obj );
|
||||
HeapFree( GetProcessHeap(), 0, pETEs );
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user