On Sun, 2 May 2010 17:26:58 -0400, Kristian Høgsberg <[email protected]> wrote:
> On Sun, May 2, 2010 at 5:02 PM, Keith Packard <[email protected]> wrote:
> > On Sat,  1 May 2010 13:31:57 -0400, Kristian Høgsberg <[email protected]> 
> > wrote:
> >
> >> All resource functions keep clientTable[cid].elements up to date with the
> >> number of resources allocated to the client.  Except
> >> FreeResourceByType().
> >
> > How about FreeClientNeverRetainResources and FreeClientResources?
> 
> I guess they don't do it either... bad assumption on my part.  But it
> *is* a bug, right?  I can fix those too and resend, but I'm just still
> surprised that this bug was in there all the time and not sure if
> instead I'm missing something subtle in the resource code.

FreeResourceByType was added for X11R4 with this bug in place, long
after the authors of the resource code were gone, so I suspect the whole
'elements' invariant was lost. I'd love to know why it was added then;
the server didn't use it at all then, and the core code still does not.

To make sure you're maintaining the invariant correctly, I'd strongly
recommend writing a debug function that walks the resource table and
verifies the number of elements along each hash chain, then simply call
that in every function that modifies the resource DB. Run the server
through a battery of tests that include damage and glx (two heavy users
of FreeReourceByType) and make sure you never break the invariant.

-- 
[email protected]

Attachment: pgpc89zCVcJLv.pgp
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to