I was testing some refactoring of the reset/reinit code, and found some intermittent crashes, especially when re-positioning several times - so I went through my changes, and eventually discovered the crashes also occur in HEAD, without any of my refactorings applied!
(My changes do seem to make the crashes occur more often, though, see below)
The crashes appear to be memory corruption - sometime the crash occurs inside OSG with bad scene data, sometimes before the crash, my C library reports non-malloc-ed or free-ed memory being accessed, and the rest of the time the crash is in the AI-traffic code, nearly always accessing bad pointers.
My hypothesis is that something in the AI-Traffic code doesn't like being re-positioned; if I reset/re-position very rapidly, I don't usually crash, whereas if I wait 20-30 seconds at a location, before re-positioning, the crash is much more likely. I think this is because this gives the AItraffic code time to 'do something', i.e spawn aircraft. (I think the OSG crashes are due to bad model-placements or similar, relating to the AI failures - though this is a wild guess)
I should add, with my refactorings applied, doing re-position at JFK, wait 30 seconds, reposition at SFO, is *almost* guaranteed to crash; with HEAD, that will crash on the 4, 5 or 6th re-position, usually. (You need to move far enough on the reposition, to trigger a tile load, I think - I usually jump around KSFO / KJFK / KLAX ...)
Can anyone confirm or deny any parts of this? I'd like to commit my refactorings, but not if they introduce a crashing bug. Ideally I'd like to fix the real crash - I'll try a valgrind run this evening - but I'd welcome any help tracking it down. If other people don't crash at all, that would of course be good to know as well!
PS - I'm well aware there's other bugs relating to reset/re-position, but please don't reply here to discuss them, or things will get very confusing! I only care about a crash during or soon after a reset or re-position, for the moment.