Hi!
The copy constructor in question:
145 FGEnvironment::FGEnvironment (const FGEnvironment &env)
146 {
147 FGEnvironment();
148 copy(env);
149 }
I guess that wants to call the default constructor first. However,
that doesn't work. See
http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.3 for details.
Confirmation:
Breakpoint 1, FGEnvironment (this=0x7fff1913c590, e...@0xc913dc0) at
src/Environment/environment.cxx:147
147 FGEnvironment();
(gdb) s
FGEnvironment (this=0x7fff1913c490) at src/Environment/environment.cxx:138
138 altitude_tropo_top_m(10000)
Observe, that the "this" pointer is different, it is pointing to a new
temporary object that will be destructed immediately after the call:
(gdb) s
~FGEnvironment (this=0x7fff1913c490) at src/Environment/environment.cxx:151
151 FGEnvironment::~FGEnvironment()
This is trivial to fix, except it is not obvious whether the members
missing from the copy() function are missing deliberately. Also
unclear: do we really want to call the functions in the default
constructor *before* the copy?
@timoore: See? Old bugs do exist! The correct way to do this was
"optimized" into the bad code more than 5.5 years ago, in rev 1.4. But
it is bad nevertheless :)
--
Csaba/Jester
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel