I've seen this also. In the mean time, as a workaround, since a
pavestats is an object that is attached to a histogram, you can do
> TCanvas *c = new TCanvas( "c","canvas",500,500);
> TPaveStats *stats = new TPaveStats(0.1,0.1,0.9,0.9);
> stats->AddText("STATS");
h->GetListOfFunctions()->Add(stats); // <----------- add this line
> stats->Draw();
> stats->SetBit( kCanDelete );
Where h is a histogram that was generated before.
Cheers
Damir
Tetsuo Arisawa wrote:
> Hello,
>
> I have troubles handling a TCanvas read from a file
> when I use the newest ROOT version, v3.03.
> Segmentation faults occur when I clear or delete the canvas.
> This has not happened in using the older ROOT versions.
> (I do not know how the file is created in detail.)
>
> According to a release note, TPaveStats class is updated from v3.03.
> So when I click one of two TPaveStats on the canvas by right mouse
> button
> and choose "Delete", then the segmentation fault shows up.
>
> In the source code of v.303, the updated destructor contain a line:
>
> if (!fParent->TestBit(kInvalidObject))
> fParent->RecursiveRemove(this);
>
> that the v.3.02 does not have.
> I think the line should be
>
> if ( fParent && !fParent->TestBit(kInvalidObject))
> fParent->RecursiveRemove(this);
>
> for stability. How do you think?
>
> You could reproduce the phenomena:
>
> {
> gROOT->Reset();
>
> TCanvas *c = new TCanvas( "c","canvas",500,500);
> TPaveStats *stats = new TPaveStats(0.1,0.1,0.9,0.9);
> stats->AddText("STATS");
> stats->Draw();
> stats->SetBit( kCanDelete );
> }
>
> Then test one of the following:
> 1. c->Delete(); or delete c;
> 2. c->Clear();
> 3. mouse right click on TPaveStats and choose Delete.
>
> If you do the following, segmentation fault disappears.
> stats->SetParent(c);
>
> Regards
> Tetsuo Arisawa
> Waseda Univ. Japan / CDF
>
>
>
--
=====================================================================
| Damir Buskulic | Universite de Savoie/LAPP |
| | Chemin de Bellevue, B.P. 110 |
| Tel : +33 (0)450091600 | F-74941 Annecy-le-Vieux Cedex |
| e-mail: buskulic@lapp.in2p3.fr | FRANCE |
=====================================================================
mailto:buskulic@lapp.in2p3.fr
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET