On Fri, May 7, 2010 at 3:13 PM, Keith Packard <kei...@keithp.com> wrote:
> On Fri,  7 May 2010 14:58:05 -0400, Kristian Høgsberg <k...@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.

Eeek, you're right.  And this is different from the other cases
because here we don't actually delete the resource which caused
another resource to be added so we'll end up doing it again.  I don't
have a good answer... we can leave it non-reentrant (didn't seem to
cause problems before, even when DRI1 apparently deleted resources
from the callback), or we can decide that the "add resource in
callback" case is not allowed.

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

Oh you're welcome.  One of these days we'll fix all the bugs in X.

Kristian
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to