Refcounting in SelectObject

Alexandre Julliard julliard at
Mon Aug 20 15:20:25 CDT 2001

Uwe Bonnes <bon at> writes:

> Appended code tries to clean up better by:
> - Remembering an unsuccessfull DeleteObject by adding 0x8000 to the Refcount
> - Call DeleteObject in SelectObject when the RefCount of the released handle
>   is 0x8000
> - Decrementing the RefCount when a hBitmap is still selected into a DC when 
>   DeleteDC is called for that DC
> - Call DeleteObject in DeleteDC when  RefCount is 0x8000
> For some applications I tested, I always saw the delayed DeleteObject done
> after the refused DeleteObject in the first place. Is this approach better?

Yes, looks good. Though we can probably safely use the dwCount field
in GDIOBJHDR since it is not used for anything useful right now,
instead of adding new fields. I've changed that and applied the patch.

Alexandre Julliard
julliard at

More information about the wine-devel mailing list