Re: preventing SEGV in TDatabasePDG::ReadPDGTable()

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Fri, 12 Mar 2010 16:17:52 +0100


Hi Robert,

Thanks for this remark. I have included your fix in the SVN trunk.

Rene Brun

Robert Hatcher wrote:
> If users call TDatabasePDG::ReadPDGTable() twice for the same input
> file the code SEGV's because AddParticle(), which normally returns a
> pointer to the newly added TParticlePDG, returns 0 if the particle
> already exists. If the entry also has decay info then it attempts to
> use the null pointer to AddDecayChannel(). The SEGV can be avoided
> by the addition of a simple "if (part)" conditional:
>
> --- montecarlo/eg/src/TDatabasePDG.cxx (revision 32529)
> +++ montecarlo/eg/src/TDatabasePDG.cxx (working copy)
> @@ -623,7 +623,7 @@
> }
> // add decay channel
>
> -
> part->AddDecayChannel(decay_type,branching_ratio,ndau,dau);
> + if (part)
> part->AddDecayChannel(decay_type,branching_ratio,ndau,dau);
> ich++;
> }
> // skip end of line
>
> This isn't necessarily ideal in that it generates a lot of "already
> defined" warning messages (from the AddParticle calls) but it avoids
> a premature exit from the program.
>
> -robert
>
> Robert W. Hatcher | rhatcher_at_fnal.gov
> <mailto:rhatcher_at_fnal.gov> 630-840-3102
> FNAL CD/REX (MINOS) | MS 220, PO Box 500, Batavia IL 60510
>
>
>
>
Received on Fri Mar 12 2010 - 16:14:51 CET

This archive was generated by hypermail 2.2.0 : Mon Mar 15 2010 - 17:50:02 CET