gdi32: Release the GDI lock when calling the DC DeleteObject function.

This commit is contained in:
Alexandre Julliard 2009-01-27 16:15:47 +01:00
parent 8f829034f3
commit b4255d295d

View File

@ -808,6 +808,7 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
{ {
/* Check if object is valid */ /* Check if object is valid */
struct hdc_list *hdcs_head;
GDIOBJHDR * header; GDIOBJHDR * header;
if (HIWORD(obj)) return FALSE; if (HIWORD(obj)) return FALSE;
@ -821,21 +822,25 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
return TRUE; return TRUE;
} }
while (header->hdcs) while ((hdcs_head = header->hdcs) != NULL)
{ {
DC *dc = get_dc_ptr(header->hdcs->hdc); DC *dc = get_dc_ptr(hdcs_head->hdc);
struct hdc_list *tmp;
header->hdcs = hdcs_head->next;
TRACE("hdc %p has interest in %p\n", hdcs_head->hdc, obj);
TRACE("hdc %p has interest in %p\n", header->hdcs->hdc, obj);
if(dc) if(dc)
{ {
if(dc->funcs->pDeleteObject) if(dc->funcs->pDeleteObject)
{
GDI_ReleaseObj( obj ); /* release the GDI lock */
dc->funcs->pDeleteObject( dc->physDev, obj ); dc->funcs->pDeleteObject( dc->physDev, obj );
header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ); /* and grab it again */
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
tmp = header->hdcs; HeapFree(GetProcessHeap(), 0, hdcs_head);
header->hdcs = header->hdcs->next; if (!header) return FALSE;
HeapFree(GetProcessHeap(), 0, tmp);
} }
if (header->dwCount) if (header->dwCount)