From: Bertrand C. <bco...@gm...> - 2010-11-07 11:37:01
|
Hi all, Unfortunately, Ola's patch introduced a couple of glitches that prevent Flight Gear to run. One of them has originally been fixed by Frédéric Bouvier in the Flight Gear git repository. I have just transposed his patch and renamed the variable 'delete_root' in 'StandAlone' because I assume that a new 'Root' property manager would only be created when JSBSim is running in stand alone mode. The second issue crashes Flight Gear while starting because the allocation of a new FDMctr must be done if FDMctr was initially set to its default NULL value even if Root is not NULL. Otherwise a segmentation fault occurs when reaching the line 149 of src/FGFDMExec.cpp : IdFDM = (*FDMctr); // The main (parent) JSBSim instance is always the "zeroth" Attached is a patch that fixes these 2 bugs. Cheers, Bertrand. 2010/9/27 Ola Røer Thorsen <ol...@si...>: > Hi Jon, > > sorry no not yet, I've been away travelling for a week. I'll try to > get it done within a couple of days. I made sort of a mess of the code > while figuring it out, so I need to clean it up a bit first :-) > > Best regards, > Ola > > > > > 2010/9/25 Jon S. Berndt <jon...@co...>: >> Ola, >> >> Did you send me a patch for this, yet? >> >> Jon >> >> >>> -----Original Message----- >>> From: Ola Røer Thorsen [mailto:ol...@si...] >>> Sent: Tuesday, September 14, 2010 3:03 PM >>> To: Development issues >>> Subject: Re: [Jsbsim-devel] Release of v1.0 (with a fix suggestion to >>> my multiple JSBSim objects issue) >>> >>> I've looked further into the code and found some bugs and potential >>> problems. >>> >>> The first one is in FGFDMExec's destructor. It has a try/catch block, >>> in which it checks for Root == 0, and if so, deletes the object >>> pointed to by the static pointer "master". Root can never be zero, so >>> this part is never executed, and the FGPropertyManager object is never >>> deleted. Root is never zero because it's set to be the same as master, >>> in FGFDMExec's constructor right after the line >>> master = new FGPropertyManager();. >>> >>> So to try to fix this I added a member variable "bool GotMaster" being >>> set to true if Root was NULL in FGFDMExec's constructor (thus creating >>> the master object), and replaced the check for Root == 0 to check if >>> this flag is true. Then master gets deleted. Also I had to add "master >>> = NULL;" after deleting it. >>> >>> This actually fixes my issue. I can create a FGFDMExec object, delete >>> it again, and create another one, and so on. :-) >>> >>> But then I tried to run several aircraft at the same time. This works >>> ok until I try deleting one of them, which causes a crash. I think >>> this is basically caused because the master pointer is static and >>> thereby shared by all the FGFDMExec objects. >>> >>> So then I just removed the static master pointer completely, changed >>> the constructor so that if Root == 0 then Root = new >>> FGPropertyManager(), and in the destructor, just delete Root instead. >>> Now everything works just fine! :-) >>> >>> So I need some input from you guys now -- I can't really see the real >>> use for the "master" pointer at all, it's barely used by the FGFDMExec >>> class, and it's also not declared as a public variable (neither is >>> Root). The child FDM's (If I understand JSBSim correctly) should get >>> the Root pointer passed to them anyway so they also don't need it. Now >>> they actually don't - in FGFDMExec::ReadChild, the object is created >>> without passing the Root pointer, for some reason, so right now, my >>> fix has probably broken something somewhere. What are the child FDM's >>> for? >>> >>> Best regards, >>> Ola >>> >>> ----------------------------------------------------------------------- >>> ------- >>> Start uncovering the many advantages of virtual appliances >>> and start using them to simplify application deployment and >>> accelerate your shift to cloud computing. >>> http://p.sf.net/sfu/novell-sfdev2dev >>> _______________________________________________ >>> Jsbsim-devel mailing list >>> Jsb...@li... >>> https://lists.sourceforge.net/lists/listinfo/jsbsim-devel >>> _______________________________________________ >>> The JSBSim Flight Dynamics Model project >>> http://www.JSBSim.org >>> _______________________________________________ >> >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing. >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> Jsbsim-devel mailing list >> Jsb...@li... >> https://lists.sourceforge.net/lists/listinfo/jsbsim-devel >> _______________________________________________ >> The JSBSim Flight Dynamics Model project >> http://www.JSBSim.org >> _______________________________________________ >> >> > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Jsbsim-devel mailing list > Jsb...@li... > https://lists.sourceforge.net/lists/listinfo/jsbsim-devel > _______________________________________________ > The JSBSim Flight Dynamics Model project > http://www.JSBSim.org > _______________________________________________ > > |