[ROOT] Safely deleting objects being browsed?

From: Conrad Steenberg (conrad@hep.caltech.edu)
Date: Wed Oct 23 2002 - 03:58:24 MEST


Hi

I'm trying to browse a TList in a TBrowser, with the list's contents
being possibly dynamic. How do I safely remove the contents of the list
so that the TBrowser(s) get notified of the change and doesn't cause
segfaults?

E.g.:
TFolder *g= gROOT->GetRootFolder()->AddFolder("Test","Test folder");
gROOT->GetListOfBrowsables()->Add((TObject*)g,"Test");
TList *l=new TList();

This adds the list and makes it browsable. Adding new objects to the
list works fine. Then remove the list:
g->RecursiveRemove(l);

This doesn't remove the list, and doing
delete l;
has the predictable effect of causing a segfault (when clicking on the
subfolder TList), since there is still a dangling link to the removed
object in the browser somewhere.

Any ideas?

Thanks!

Conrad


-- 
*-----------------------------------------*
| Conrad Steenberg                        |
| Caltech, Mail Code 356-48               |
| Pasadena, CA, 91125                     |
| e-mail: conrad@hep.caltech.edu          |
| Tel: (626) 395-8758                     |
*-----------------------------------------*



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