Hi John,
Then using gApplication should be safe and not lead not any crash. Can you tell enough information for me to try to reproduce your problem?
Thanks,
Philippe.
John Idarraga wrote:
> Hell Philippe,
>
> I am using root.exe
>
> 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:28:00 CET
This archive was generated by hypermail 2.2.0 : Wed Nov 25 2009 - 23:50:02 CET