On 24 Apr 2012, at 15:57, Curtis Olson wrote:

> I tried running with valgrind and the error didn't happen -- hmmm...
> 
> Trying it again, but a valgrind startup is excruciatingly slow ...

It's probably a reference counting issue. FGAirport is a FGPositioned and hence 
reference counted. The Nasal Ghost is supposed to deal with this - when we 
create a ghost around the airport, we take a reference (SGReferenced::get) and 
when Nasal garbage-collects the ghost, the reference count is decremented. 
(SGReferenced::put)

If the reference count hits zero, the airport will be freed, leading to the 
issue you see. But that would imply there's nothing else holding a reference to 
the airport, and that's not the case, because the the spatial index (the 
octree) in positioned.cxx holds a reference to everything at the moment.

If I'd screwed up the ref-counting logic completely, I'd expect it to be 
crashing for me exactly the same, and it's not. Very weird.

So likely I have made a subtle screw-up that only affects Linux. You could test 
this by commenting out the call to

        SGreferencd::put()

in sgrefGhostDestroy - references will be leaked, but if it stops the crash 
then we can be sure it's a ref-counting bug.

James


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to