Re: TPad::Divide

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 05 Jan 2005 09:19:25 +0100


Hi Thomas,

What you do should work unless there is very special case connected with signals that I do not see.
Did you check (with a print in the destructor) that your object is deleted twice?
Could you run with valgrind?
The best would be to send the shortest possible running script reproducing the problem. Please indicate your version of ROOT.

Rene Brun

Thomas Bretz wrote:
>
> Dear all,
>
> there is something I don't understand.
>
> Assume I have created a TCanvas c. I have divided the canvas in two
> subpads p1 and p2 and these are divided into p11, p12, p21 and p22 using
> c.Divide(). Now I Draw an object in two different looks (eg
> Draw("option1"), Draw("option2")) to p11 and p22.
> Because I don't want to have the owenership of the object I call
> SetBit(kCanDelete) for it.
>
> If I now delete the canvas something - in my opinion - strange happens.
> Because the two subpads are not in gROOT->GetListOfCleanups() it seems
> that under some circumstances (which I cannot resolve) p11 _and_ p22 are
> trying to delete my object and I get a crash. On the other hand the
> Canvas containing the objects are in the ListOfCleanups and each of the
> object - when deleted - should call recursiveRemove which should - in
> all of its subpads - remove the object from all ListOfPrimitves.
>
> Simply adding p1 and p2 to the ListOfCleanups solves the Problem. Does
> somebody have any idea what may go on?
>
> There is only one thing else which might be important: The object (in
> its Draw function) calls
>
> gPad->GetCanvas()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
> "MyClass", this, "EventInfo(Int_t,Int_t,Int_t,TObject*)");
>
> I disconnect the Signal in the destructor.
>
> Best regards,
> Thomas.
Received on Wed Jan 05 2005 - 09:18:12 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET