Dammit - wrote this whole thing out only to lose it because my login had timed out!
Ok, here we go again...
I've stripped down the code substantially to help this along. Removed the other derived classes of Satellite, leaving only the SGP4_Sat derived class which is used in the app. Stripped out a bunch of other data member and associated functions which aren't used for this app. The code is now crashing in a different manner.
What's happening is that I'm making the following call:
target->propagate_to(Tx, false);
target is a Satellite* object pointing to an SGP4_Sat object.
propagate_to() is a virtual function.
When the call to propagate_to() is made the call actually goes to SGP4_Sat::check_object(), which is a pure virtual function within Satellite.
The call to check_object() completes normally and returns, but the fact that the target object wasn't propagated triggers an assert a few lines later. The earlier error was also an erroneous jump to check_object() but it manifested differently because it was actually crashing within a function called from check object. But that functionality was removed in stripping things down.
When within the check_object() call I looked at *this and everything looked normal.
The SGP4_Sat object is allocated in the main() function as such:
SGP4_Sat sat(line1, line2);
This is a constructor unique to SGP4_Sat.
It becomes a Satellite* when passed to the following function:
find_viz(&sensor, &sat, jd0, jd1, min_elev, max_elev, optical_vizfunc, dbl_args, int_args, vw);
Which has the following prototype:
1 2 3 4 5 6 7
|
int find_viz(Point *site, Satellite *target,
const JulianDate &start, const JulianDate &end,
double min_elev, double max_elev,
bool (viz_func)(const Point *site, const Satellite *target_ecr,
const vector<double> &dbl_args, const vector<int> &int_args),
const vector<double> &dbl_args, const vector<int> &int_args,
vector<VizWindow> &final_windows)
| |
I've also tried declaring the SGP4_Sat object on the heap as such:
1 2 3 4 5
|
SGP4_Sat *sat;
sat = new SGP4_Sat;
sat->init(line1, line2);
| |
The error behavior is identical.
I stepped through some of the code and found that calls to non-virtual Satellite member functions are being executed properly. Earlier calls to propagate_to() are also being misdirected to check_object() also, but aren't being caught.
I'm about to try two things:
- add a call to another Satellite virtual function and see if it is also mis-directed
- add a call to an SGP4_Sat function which is unique to SGP4_Sat and see if it is resolved correctly.
Any help, observations, suggestions for other things to look at is appreciated!