Re: Poor Man's GDI Object Refcount

2001-01-14 Thread Eric Pouech

Uwe Bonnes wrote:
  typedef struct tagGDIOBJHDR
  {
  HANDLE16hNext;
  WORDwMagic;
  DWORD   dwCount;
 +HDC refcount;
  } GDIOBJHDR;
doh... wouldn't it be better if refcount were an int ?
(Franois shall not like it when -DSTRICT is turned on ;-)

A+

-- 
---
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle




Re: Poor Man's GDI Object Refcount

2001-01-14 Thread Andreas Mohr

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
  {
  HANDLE16hNext;
  WORDwMagic;
  DWORD   dwCount;
 +HDC refcount;
  ^^^ ???

  } GDIOBJHDR;

Andreas Mohr




Re: Poor Man's GDI Object Refcount

2001-01-14 Thread Huw D M Davies

On Sun, Jan 14, 2001 at 02:48:21PM -0600, Andreas Mohr wrote:
 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.

The header is the same as 16bit GDI at the momenet, however the
storage of some of the actual objects is completely different, so I
don't think we lose much by breaking this 'compatibility'.

Huw.
-- 
   Dr. Huw D M Davies  | Clarendon Laboratory
   [EMAIL PROTECTED]  | Parks Road
   Tel: +44 1865 272390| Oxford OX1 3PU
   Fax: +44 1865 272400| UK




Re: GDI object refcount?

2000-11-10 Thread Niclas Karlsson MATE



 Well, if you can implement this, then just go ahead.
 Just remember that you have to do the refcount increase/decrease in every
 single SelectObject function.
 On the other hand I think I know more about that at the moment ;)
 So if you don't want to do it, then I'll do.

Hmm. I think it would be nice if you could do it :)

As you said, you seem to know your way around that code way better than
me.

Nicke
-- 
-[ [EMAIL PROTECTED] ]-  Seek simplicity, and distrust it. (A. Whitehead)




Re: GDI object refcount?

2000-11-10 Thread Andreas Mohr

On Fri, Nov 10, 2000 at 11:21:39PM +0200, Niclas Karlsson MATE wrote:
 
 
  Well, if you can implement this, then just go ahead.
  Just remember that you have to do the refcount increase/decrease in every
  single SelectObject function.
  On the other hand I think I know more about that at the moment ;)
  So if you don't want to do it, then I'll do.
 
 Hmm. I think it would be nice if you could do it :)
oki.
I'll try to do it this weekend.

Andreas Mohr