[Flightgear-devel] Re: crash in FGAIPlane::Update(double)

2004-03-03 Thread Alex Romosan
Alex Romosan [EMAIL PROTECTED] writes:

 i haven't been able to use flightgear for the past couple of days as
 it crashes in FGAIPlane::Update(double) (actually it doesn't quite
 crash, the sim just freezes and i have to kill it from the command
 prompt). this is the gdb backtrace:

 0x080d49fe in FGAIPlane::Update(double) (this=0xd4dee98, 
 dt=0.039636) at AIPlane.cxx:124
 124 while((track - _tgtTrack)  180.0) track -= 360.0;
 (gdb) where
 #0  0x080d49fe in FGAIPlane::Update(double) (this=0xd4dee98, 
 dt=0.039636) at AIPlane.cxx:124
 #1  0x080a9e1a in FGAIGAVFRTraffic::Update(double) (this=0xd4dee98, 
 dt=0.039636) at AIGAVFRTraffic.cxx:116
 #2  0x0809df5c in FGAIMgr::update(double) (this=0x92efae8, 
 dt=0.039636) at AIMgr.cxx:307
 #3  0x0805b82e in fgMainLoop () at globals.hxx:263
 #4  0x4020c84a in glutMainLoop () from /usr/local/lib/libglut.so.3
 #5  0x0805df18 in fgMainInit(int, char**) (argc=1, argv=0xb614)
 at main.cxx:1706
 #6  0x080588f9 in main (argc=223221810, argv=0xd4e1832) at bootstrap.cxx:139

 i haven't tried to understand the code yet, as i am hoping a more
 knowledgeable person will figure out what's happening and fix it. thanks.

i looked at the code in AIPlane.cxx:122

if(_trackSet) {
while((_tgtTrack - track)  180.0) track += 360.0;
while((track - _tgtTrack)  180.0) track -= 360.0;
double turn_time = 60.0;
track += (360.0 / turn_time) * dt * (_tgtTrack  track ? 1.0 : -1.0);
Bank(25.0 * (_tgtTrack  track ? 1.0 : -1.0));

track is defined as a protected member but i can't figure out where
it's set prior to this. it's not initialized in the constructor
(should it be set to zero?), or from anywhere else. when the program
crashes, track has some huge value. is it garbage? this code was added
in the last revision, so i am sure this is what is causing the crash.

--alex--

-- 
| I believe the moment is at hand when, by a paranoiac and active |
|  advance of the mind, it will be possible (simultaneously with  |
|  automatism and other passive states) to systematize confusion  |
|  and thus to help to discredit completely the world of reality. |

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


Re: [Flightgear-devel] Re: crash in FGAIPlane::Update(double)

2004-03-03 Thread David Luff
Alex Romosan writes:

 Alex Romosan writes:
 
  i haven't been able to use flightgear for the past couple of days as
  it crashes in FGAIPlane::Update(double) (actually it doesn't quite
  crash, the sim just freezes and i have to kill it from the command
  prompt). this is the gdb backtrace:
 
  0x080d49fe in FGAIPlane::Update(double) (this=0xd4dee98, 
  dt=0.039636) at AIPlane.cxx:124
  124 while((track - _tgtTrack)  180.0) track -= 360.0;
  (gdb) where
  #0  0x080d49fe in FGAIPlane::Update(double) (this=0xd4dee98, 
  dt=0.039636) at AIPlane.cxx:124
  #1  0x080a9e1a in FGAIGAVFRTraffic::Update(double) (this=0xd4dee98, 
  dt=0.039636) at AIGAVFRTraffic.cxx:116
  #2  0x0809df5c in FGAIMgr::update(double) (this=0x92efae8, 
  dt=0.039636) at AIMgr.cxx:307
  #3  0x0805b82e in fgMainLoop () at globals.hxx:263
  #4  0x4020c84a in glutMainLoop () from /usr/local/lib/libglut.so.3
  #5  0x0805df18 in fgMainInit(int, char**) (argc=1, argv=0xb614)
  at main.cxx:1706
  #6  0x080588f9 in main (argc=223221810, argv=0xd4e1832) at bootstrap.cxx:139
 
  i haven't tried to understand the code yet, as i am hoping a more
  knowledgeable person will figure out what's happening and fix it. thanks.
 
 i looked at the code in AIPlane.cxx:122
 
 if(_trackSet) {
 while((_tgtTrack - track)  180.0) track += 360.0;
 while((track - _tgtTrack)  180.0) track -= 360.0;
 double turn_time = 60.0;
 track += (360.0 / turn_time) * dt * (_tgtTrack  track ? 1.0 : -1.0);
 Bank(25.0 * (_tgtTrack  track ? 1.0 : -1.0));
 
 track is defined as a protected member but i can't figure out where
 it's set prior to this. it's not initialized in the constructor
 (should it be set to zero?), or from anywhere else. when the program
 crashes, track has some huge value. is it garbage? this code was added
 in the last revision, so i am sure this is what is causing the crash.
 

Oops, thanks for the catch, the machine I tested it on (Cygwin) must have been 
initialising to zero, I was wondering why Flightgear was freezing on my Linux box on 
the last update!!

I'll commit a fix tomorrow.

Cheers - Dave

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel