Re: application

From: John Idarraga <idarraga_at_cern.ch>
Date: Wed, 25 Nov 2009 14:28:22 -0500


Hello Again Phillipe,

I tried to see if I can catch that segfault with gdb. But when I use gdb (and gApplication) I don't get a crash anymore. mmm ... I know objects allocated in the heap can behave randomly in unstable cases but it runs well on every single try I do with gdb. This is way too weird. I don't know. May be I am doing something really wrong. I will check further.

John

On Wed, 2009-11-25 at 12:59 -0600, Philippe Canal wrote:
> Hi John,
>
> > - Code that works: I call 'new TApplication(...)
> > The constructor complains, but it
> > still give me a new instance and my program runs well.
>
> It is strange that you both have the complaint __and__ a non
> functioning gApplication (see below though)
>
> > I am writing an application that is using the ROOT library.
>
> Are you using your own main function or are you using root.exe?
>
> If you have your own main function, the proper thing to do is
> to create a TApplication object (or a TRint object) as early
> as possibly in the main function. If you do not create a
> TApplication object, one will be created for you when ROOT needs
> it (but accessing gApplication or GetApplication does not provoke
> this loading).
>
> Cheers,
> Philippe.
>
> PS. If gApplication is not null, it should be functional and useable.
>
>
> John Idarraga wrote:
> > Hello Philippe,
> >
> > Thanks for your answer, here:
> >
> > - Code that do not work: When I use gApplication. Do I need to call
> > anything else. Call a member of gApplication or something ?
> >
> > - Code that works: I call 'new TApplication(...) inside my code and use
> > that pointer instead of gApplication. The constructor complains, but it
> > still give me a new instance and my program runs well.
> >
> > thanks,
> >
> > John Idarraga
> >
> > On Wed, 2009-11-25 at 12:29 -0600, Philippe Canal wrote:
> >
> >> Hi John,
> >>
> >>
> >>> I do so, and I get a valid pointer, but when doing this, my program crashes.
> >>>
> >> I do not quite understand the code that works and the code that do not work.
> >>
> >> The unique TApplication object can (should) always be access via
> >> gApplication.
> >>
> >> Cheers,
> >> Philippe
> >>
> >>
> >> John Idarraga wrote:
> >>
> >>> Hello people,
> >>>
> >>> Little question. I am writing an application that is using the ROOT
> >>> library. I still want to run my library making instances of my objects
> >>> from CINT and steering the run from there. At some point I need to get
> >>> a handle on a TApplication object. Since I am not providing the 'main'
> >>> call of my application because I am running with CINT, that object
> >>> should already exist, right ? I see that ROOT has already instantiated
> >>> and object of the class TApplication and I can get a pointer to it
> >>> through the global gApplication pointer or through
> >>> gROOT->GetApplication(). I do so, and I get a valid pointer, but when
> >>> doing this, my program crashes.
> >>>
> >>> I couldn't do much with gdb to find out what was going on. But if
> >>> instead I try to build a new instance of TApplication myself, the
> >>> constructor of TApplication tells me "only one instance of TApplication
> >>> allowed", but still delivers me a new object and this one let me work
> >>> without crash. I am surely miss-understanding something here. Any
> >>> ideas ?
> >>>
> >>> thanks,
> >>>
> >>> John Idarraga
> >>>
> >>>
> >>>
> >>>
> >
> >
>
Received on Wed Nov 25 2009 - 20:27:43 CET

This archive was generated by hypermail 2.2.0 : Wed Nov 25 2009 - 23:50:02 CET