RE: TGListTree clear problem

From: Anton Fokin (fokin@tsl.uu.se)
Date: Fri Feb 25 2000 - 18:12:03 MET


Hi Fons,

the problem with deleting item in TGListTree is around TGPicture. When you
delete item, you also free resources for open and close pictures. If the
same reference to a picture serves other items, it produces a crash. I am
using for example

fIPicture = fClient->GetPicture("doc_t.xpm");

in the constructor of class inherited from TGListTree and then I use this
fIPicture whenever I need to add an item with doc_t.xpm view.

Any suggestions?

Regards,
Anton


-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Fons Rademakers
Sent: Tuesday, February 22, 2000 4:59 PM
To: Anton Fokin
Cc: roottalk@pcroot.cern.ch
Subject: Re: TGListTree clear problem


Hi Anton,

  this should work. Can you produce a stack trace in the debugger?

-- Fons


Anton Fokin wrote:
>
> Hi!
>
> I am trying to clear (well, delete all TGListTreeItem) TGListTree. I was
> thinking of
>
>   TGListTreeItem* FirstItem = TGListTree::GetFirstItem();
>   if (FirstItem)
>     TGListTree::DeleteItem(FirstItem);
>
> but it gives a segmentation violation ... as well as
> TGListTree::DeleteChildren(FirstItem) ... Any suggestions?
>
> Best,
> Anton

--
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET