Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 475 of file gdiobj.c.
Referenced by BITMAP_CopyBitmap(), GDIOBJ_ConvertToStockObj(), GDIOBJ_ReferenceObjectByHandle(), GDIOBJ_vDeleteObject(), GreDeleteObject(), GreGetObject(), GreIsHandleValid(), GreSetObjectOwner(), IntGdiSetMetaRgn(), and NtGdiSetColorSpace().
{ ULONG cRefs, ulIndex; /* Calculate the index */ ulIndex = GDI_HANDLE_GET_INDEX(pobj->hHmgr); /* Check if the object has a handle */ if (ulIndex) { /* 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) { /* Make sure it's ok to delete the object */ ASSERT(pobj->BaseFlags & BASEFLAG_READY_TO_DIE); /* Check if the handle was process owned */ if (gpentHmgr[ulIndex].ObjectOwner.ulObj != GDI_OBJ_HMGR_PUBLIC && gpentHmgr[ulIndex].ObjectOwner.ulObj != GDI_OBJ_HMGR_NONE) { /* Decrement the process handle count */ ASSERT(gpentHmgr[ulIndex].ObjectOwner.ulObj == HandleToUlong(PsGetCurrentProcessId())); DecrementGdiHandleCount(); } /* Push entry to the free list */ ENTRY_vPushFreeEntry(&gpentHmgr[ulIndex]); /* Free the object */ GDIOBJ_vFreeObject(pobj); } } else { /* 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) { /* Free the object */ GDIOBJ_vFreeObject(pobj); } } }