- In DC_vSetOwner, do not take ownership of the current dc brush and pen, instead dereference them and select default brush and pen. Fixes bug #7070
- Fix debug logging in GDIOBJ_vDereferenceObject
- create debug log event in GDIOBJ_vSetObjectOwner

svn path=/trunk/; revision=56579
This commit is contained in:
Timo Kreuzer 2012-05-13 18:29:31 +00:00
parent 12ad95e140
commit cb936d362c
2 changed files with 19 additions and 8 deletions

View file

@ -414,8 +414,19 @@ DC_vSetOwner(PDC pdc, ULONG ulOwner)
GreSetObjectOwner(pdc->dclevel.hPath, ulOwner);
}
IntGdiSetBrushOwner(pdc->dclevel.pbrFill, ulOwner);
IntGdiSetBrushOwner(pdc->dclevel.pbrLine, ulOwner);
/* Dereference current brush and pen */
BRUSH_ShareUnlockBrush(pdc->dclevel.pbrFill);
BRUSH_ShareUnlockBrush(pdc->dclevel.pbrLine);
/* Select the default fill and line brush */
pdc->dcattr.hbrush = StockObjects[WHITE_BRUSH];
pdc->dcattr.hpen = StockObjects[BLACK_PEN];
pdc->dclevel.pbrFill = BRUSH_ShareLockBrush(pdc->pdcattr->hbrush);
pdc->dclevel.pbrLine = PEN_ShareLockPen(pdc->pdcattr->hpen);
/* Update the EBRUSHOBJs */
EBRUSHOBJ_vUpdate(&pdc->eboFill, pdc->dclevel.pbrFill, pdc);
EBRUSHOBJ_vUpdate(&pdc->eboLine, pdc->dclevel.pbrLine, pdc);
/* Allocate or free DC attribute */
if (ulOwner == GDI_OBJ_HMGR_PUBLIC || ulOwner == GDI_OBJ_HMGR_NONE)

View file

@ -476,18 +476,16 @@ GDIOBJ_vDereferenceObject(POBJ pobj)
{
ULONG cRefs, ulIndex;
/* Log the event */
DBG_LOGEVENT(&pobj->slhLog, EVENT_DEREFERENCE, cRefs);
/* Calculate the index */
ulIndex = GDI_HANDLE_GET_INDEX(pobj->hHmgr);
/* Check if the object has a handle */
if (GDI_HANDLE_GET_INDEX(pobj->hHmgr))
if (ulIndex)
{
/* Calculate the index */
ulIndex = GDI_HANDLE_GET_INDEX(pobj->hHmgr);
/* Decrement reference count */
ASSERT((gpaulRefCount[ulIndex] & REF_MASK_COUNT) > 0);
cRefs = InterlockedDecrement((LONG*)&gpaulRefCount[ulIndex]);
DBG_LOGEVENT(&pobj->slhLog, EVENT_DEREFERENCE, cRefs);
/* Check if we reached 0 and handle bit is not set */
if ((cRefs & REF_MASK_INUSE) == 0)
@ -517,6 +515,7 @@ GDIOBJ_vDereferenceObject(POBJ pobj)
/* Decrement the objects reference count */
ASSERT(pobj->ulShareCount > 0);
cRefs = InterlockedDecrement((LONG*)&pobj->ulShareCount);
DBG_LOGEVENT(&pobj->slhLog, EVENT_DEREFERENCE, cRefs);
/* Check if we reached 0 */
if (cRefs == 0)
@ -777,6 +776,7 @@ GDIOBJ_vSetObjectOwner(
/* Set new owner */
pentry->ObjectOwner.ulObj = ulOwner;
DBG_LOGEVENT(&pobj->slhLog, EVENT_SET_OWNER, 0);
}
/* Locks 2 or 3 objects at a time */