Thorsten,

Thanks for your prompt reply.

I get that the pointer is NULL, but I do not understand why!

I believe that I have called the correct method to return a pointer to the 
object.  And since I know that the object has been instantiated (since i get a 
cout message to tell me and also i can see the object doing what its supposed 
to be doing on screen).

Do you have any idea why this object may be null? have i correctly registered 
the instrument? does the instrument not persist until program completion? How 
do I correctly obtain a pointer to this object if this is not the correct way?

Thanks

Robbo

> Date: Tue, 11 Oct 2011 23:42:42 +0200
> From: bre...@gmail.com
> To: flightgear-devel@lists.sourceforge.net
> Subject: Re: [Flightgear-devel] Object scope help
> 
> On 11.10.2011 23:31, Robbo wrote:
> > TaRadar* _taradar_node = (TaRadar*) globals->get_subsystem("
> > taradar");
> >
> > Now then, if TaRadar::getAngle() has the following fixed code:
> > return 10;
> > everything works ok, but if the method returns an object variable:
> > return _angle;
> > I get a segmentation fault.
> 
> That means "_taradar_node" is NULL. Calling _taradar_node->getAngle() is 
> illegal if _taradar_node=0. However, if the method you're calling 
> doesn't access the object itself, but just returns a constant ("return 
> 10"), then nothing happens (lucky!). Add a check "if (_taradar_node!=0) 
> ..." and see why the pointer is NULL.
> 
> cheers,
> Thorsten
> 
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
                                          
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to