[Plib-users] Segmentation Fault - FG.9.8 Fedora Core 3 plib-1.8.4
Brought to you by:
sjbaker
From: Doug W. <Dou...@sh...> - 2005-03-07 21:10:58
|
I'm trying to run FlightGear.9.8 and the joystick initialization crashes and causes a segmentation fault on my machine. I have a Microsoft Sidewinder Force Feedback 2 joystick, FG.9.8. on Fedora Core 3. athlon cpu and ati radeon AIW video card and plib-1.8.4 I have isolated the problem to this code in file plib/src/js/jsLinux.cxx // Remove any deadband value already done in the kernel. // Since we have our own deadband management this is save to do so. struct js_corr corr [ _JS_MAX_AXES ]; ioctl ( os->fd, JSIOCGCORR, corr ); for ( int i = 0; i < num_axes ; ++i ) { if ( corr[ i ] . type == JS_CORR_BROKEN ) { int nodeadband = ( corr[ i ] . coef[ 0 ] + corr[ i ] . coef [ 1 ] ) / 2 ; corr[ i ] . coef[ 0 ] = nodeadband ; corr[ i ] . coef[ 1 ] = nodeadband ; } } ioctl ( os->fd, JSIOCSCORR, corr ); The Segmentation Fault is caused by the first ioctl() call. It overwrites more than the struct js_corr structure and corrupts the THIS pointer. then the next line: for ( int i =0; i< num_axes;++i) generates a Segmentation Fault when it tries to access num_axes because the THIS pointer is now pointing at 0x0010000 memory address. I have been unable to figure out how to fix it but if someone can give me some help I'm sure we can figure it out. I have commented out this code and FlightGear compiles and runs without trouble. Thanks, Doug. |