On Sun, Jan 14, 2001 at 06:45:55PM +0100, Uwe Bonnes wrote:
> Hallo,
>
> as reported yesterday, some application depended on DeleteObject
> failing as long as the Object is stillselected into some DC. Andi also
> noted the need for such a check some time ago. This patch adds an
> entry "refcount" in GDIOBJHDR and increments/decrements this refcount
> in SelectObject and denies DeleteObjects if the refcount isn't zero.
Sorry, this is not correct, I think.
First, GDIOBJHDR is a *fixed* structure AFAIK. It should not be changed.
But on the other hand you're right. GDIOBJHDR is the place to do this at.
I used dwCount for that. But I'm not sure whether it's correct yet.
Second, SelectObject()/DeleteObject() are not the only places that need
to fiddle with the refcount AFAICS.
AFAICS the behaviour of different GDI objects is different when
it comes to refcounting. That's why I think you need to do this in
the graphics driver's SelectObject functions...
Third, this patch should be issued after much more testing.
I noticed that Wine with refcounting enforced (or at least with my
version of it) breaks several applications.
(probably because I missed some other cases where we need to take care
of the refcount)
> typedef struct tagGDIOBJHDR
> {
> HANDLE16 hNext;
> WORD wMagic;
> DWORD dwCount;
> + HDC refcount;
^^^^^^^ ???
> } GDIOBJHDR;
Andreas Mohr