Re: [ROOT] another two stupid questions.

From: Jacek M. Holeczek (holeczek@us.edu.pl)
Date: Tue Feb 19 2002 - 09:13:00 MET


Hi,
> (... Question One ...)
> I do not understand this problem. You do not need to reset the bit
Assume the following in the subroutine :
	TGraph *g = new TGraph(n, xtable, ytable)
	g->SetName("ACPE23Mat250NS"); g->SetTitle("ACPE23Mat250NS");
	gDirectory->Append(g);
Then, outside of the subroutine :
	root [2] gROOT->FindObject("ACPE23Mat250NS")
	(const class TObject*)0x8ec4c90 // IT IS THERE
	root [3] ACPE23Mat250NS->Draw("ALP")
	<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
	Warning in <TH1::Build>: Replacing existing histogram: ACPE23Mat250NS (Potential memory leak).
	root [4] gROOT->FindObject("ACPE23Mat250NS")
	(const class TObject*)0x8ec4c90 // IT IS STILL THERE
	root [5] c1->Clear()
	root [6] gROOT->FindObject("ACPE23Mat250NS")
	(const class TObject*)0x0 // IT IS GONE
And ... my graph is lost forever.
I tried to protect myself against it using (in my subroutine) :
	g->ResetBit(kCanDelete); g->ResetBit(kMustCleanup);
before gDirectory->Append(g), but it didn't help.
Thanks in advance,
Jacek.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:42 MET