Re: [ROOT] A littel macro and a bug

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Aug 24 2000 - 18:58:50 MEST


Hi Yannick,

   CINT seems to get confused by the fact that "p" has not been declared
properly (while not complaining about it, which is a CINT extension).

Change:

   p = new  TPad("a","b",.1,.1,.9,.9);

to

   TPad *p = new  TPad("a","b",.1,.1,.9,.9);

and the problem is solved.


Cheers, Fons.


Patois Yannick wrote:
> 
> Hi,
> 
> If I launch root and run the following macro twice, root dont like it.
> 
> root [0] .x bug.C
> root [1] .x bug.C
> 
>  *** Break *** segmentation violation
> 
> Shouldnt simply the canva be replaced by the newest one ?
> 
> The reported error is not the same if I comment the 'typedef' at first
> line.
> 
> Code :
> 
> <<<<<<
> typedef enum {no_beam,he6_beam,be11_beam     } E_beam_style;
> void bug(void)
> {
>   for (int i=0;i<2;i++) do_it();
> }
> void do_it(void)
> {
>   TCanvas *cnv= multipad(1);
> }
> TCanvas* multipad(int cx)
> {
>   char s0[100];
>   sprintf(s0,"c%d",cx);
>   TCanvas *cnv = new TCanvas(s0,s0,500,500);
>   p = new  TPad("a","b",.1,.1,.9,.9);
>   return(cnv);
> }
> >>>>>>>
> 
> Thanx for any help.
> 
>         Yannick
> 
> --
>  _/ Yannick Patois _________________ Address (home) __________________
> | irc(undernet): Garp on #france25+  | La Villa des Sciences           |
> | email : patois@ganil.fr            | 12, avenue de Cambridge         |
> | http://garp.feelingsurfer.net/     | 14200 Herouville-Saint-Clair    |
> | Tel/Fax-home:+33 (0)2 31 94 50 32  | FRANCE                          |

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET