[PATCH 1/4] dix: Update element count in FreeResource*()

Keith Packard keithp at keithp.com
Fri May 7 12:13:31 PDT 2010


On Fri,  7 May 2010 14:58:05 -0400, Kristian Høgsberg <krh at bitplanet.net> wrote:

>      resources = clientTable[client->index].resources;
> +    eltptr = &clientTable[client->index].elements;
>      for (i = 0; i < clientTable[client->index].buckets; i++) {
>          for (this = resources[i]; this; this = next) {
>  	    next = this->next;
>  	    if (!type || this->type == type) {
>  		/* workaround func freeing the type as DRI1 does */
>  		value = this->value;
> +		elements = *eltptr;
>  		if((*func)(value, this->id, cdata))
>  		    return value;
> +		if (*eltptr != elements)
> +		    next = resources[i]; /* start over */

This one scares me a bit -- what happens if the function *adds* a
resource? You'll rescan the table and call it again with the same
resource.

Everything else looks great; thanks for finding the oldest bug this
year.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100507/90acb2f9/attachment.pgp>


More information about the xorg-devel mailing list