Re: [brlcad-devel] Debugging g-nff and Friends
Open Source Solid Modeling CAD
Brought to you by:
brlcad
|
From: Christopher S. M. <br...@ma...> - 2012-04-16 15:08:05
|
On Apr 16, 2012, at 10:56 AM, Tom Browder wrote: > On Mon, Apr 16, 2012 at 07:52, Christopher Sean Morrison <br...@ma...> wrote: >> >> On Apr 16, 2012, at 7:24 AM, Tom Browder wrote: > ... >>> 2. Shouldn't a test for the "free flag" be built into the >>> db_free_tree function to return silently if the tree is already freed? >> >> That's a possible solution but doesn't sound like the right one. >> If a tree pointer was freed, it shouldn' t be referenced any longer. That's the problem. > > [1] Does that mean the tree pointer itself should have been set to > zero after the free? Possibly, but usually the "dead" tree nodes are removed. Some NMG code, however, defers removals until after an entire list has been processed (for obvious performance reasons). I haven't looked at that specific code in question, but setting a pointer to NULL is more likely to cause a NULL dereference crash than setting magic to invalid (so that a bomb kicks instead of a crash) so it wouldn't be my first inclination. Cheers! Sean |