Re: [ROOT] kCanDelete

From: Damir Buskulic (buskulic@lapp.in2p3.fr)
Date: Wed Jun 13 2001 - 14:29:47 MEST


Hi Thomas,

I suppose it depends if the gr2 graph deletes the previous one, i.e.
what kind of drawing options you use.

if gr2 replaces gr1 (option containing "A") then gr1 is deleted when it
is replaced
if gr2 is superimposed on gr1 (option does not contain "A") then, both
graphs are deleted when the canvas is deleted

Someone correct me if I'm wrong...

Cheers

Damir

Thomas Bretz wrote:
> 
> Hi Rooters,
> 
> from an earlier mail of somebody I found, that:
> ------
> TCanvas *c1 = new TCanvas("Name", "Title");
> TGraph *gr = new TGraph(...);
> gr->SetBit(kCanDelete);
> gr->Draw();
> delete c1;
> ------
> 
> doesn't leak memory, because the histogram is deleted together with the
> Canvas. What's about the following example:
> ------
> TCanvas *c1 = new TCanvas("Name", "Title");
> TGraph *gr1 = new TGraph(...);
> gr1->SetBit(kCanDelete);
> gr1->Draw();
> TGraph *gr2 = new TGraph(...);
> gr2->SetBit(kCanDelete);
> gr2->Draw();
> delete c1;
> ------
> 
> Thanks for your help,
> Thomas.

-- 
=====================================================================
| 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 : Tue Jan 01 2002 - 17:50:49 MET