Re: Bug in tilesortspu_context?

Brian Paul <[email protected]> Mon, 20 Jun 2005 13:50:43 -0600
Newsgroups gmane.comp.graphics.chromium.devel
Message-ID <[email protected]>
[email protected] wrote:
> Hi all,
> 
> At the end of tilesortspu_context.c, the existing code in
> tilesortspu_DestroyContext looks like this:
> 
> /* Destroy the tilesort state context */
> crFree(contextInfo->server);
> crStateDestroyContext(contextInfo->State);
> crHashtableDelete(tilesort_spu.contextTable, ctx, crFree);
> 
> /* The default buffer */
> crPackSetBuffer( thread0->packer, &(thread->geometry_buffer) );
> 
> crDLMFreeContext(contextInfo->dlmContext);
> 
> -------
> 
> The problem is that, apparently, crHashtableDelete is deleting the data
> pointed to by contextInfo. (contextInfo is retrieved from the hashtable
> earlier in the function.)
> 
> So, a version that seems to work better for me (i.e. no crash on context
> deletion) is:
> 
> /* Destroy the tilesort state context */
> crFree(contextInfo->server);
> crStateDestroyContext(contextInfo->State);
> 
> /* The default buffer */
> crPackSetBuffer( thread0->packer, &(thread->geometry_buffer) );
> 
> crDLMFreeContext(contextInfo->dlmContext);
> 
> crHashtableDelete(tilesort_spu.contextTable, ctx, crFree);
> 
> ----

That looks like a good fix.  I'll check it in.

-Brian


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click