Re: TPad::Divide

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 05 Jan 2005 15:07:38 +0100


Hi Thomas,

valgrind is a very nice system that can save you a lot of time discovering things like uninitialized variables, double deletes, showing a profile of the memory use, etc. For more info about valgrind, see:   http://valgrind.kde.org/index.html

for example to run valgrind on your root.exe application, do:   valgrind --tool=addrcheck root.exe

Rene Brun

Thomas Bretz wrote:
>
> Hi Rene,
>
> I'm currently working with root 3.10/02. It is not easy to find a simple
> script reproducing the problem. I can reproduce it, but not with a
> simple program. Otherwise I may already know what the real reason is.
> Sorry to ask, but what is 'valgrind'? If it is not too difficult I can try.
>
> Thomas.
>
> Rene Brun wrote:
> > 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 - 15:06:27 MET

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