Re: Wanted: TObject dtor improvement

From: Fons Rademakers (rdm@pcsalo.cern.ch)
Date: Sat Nov 14 1998 - 10:30:25 MET


Hi Valery,

  I agree completely with you proposal. We wanted to do this already
for a long time (to make general "observed" containers instead of 
just the two specific cases for Canvases and Browsers).

So the change will be coming.

Cheers, Fons.


> 
>   Hello list the current TObject dtor looks as follows:
> 
> 
> //______________________________________________________________________________
> TObject::~TObject()
> {
>    // TObject destructor. Removes object from all canvases and object browsers
>    // iff observer bit is on and remove from the global object table.
> 
>    // if (!TestBit(kNotDeleted))
>    //    Fatal("~TObject", "object deleted twice");
> 
>    if (gROOT) {
>       if (gROOT->MustClean()) {
>          if (gROOT == this) return;
>          if (TestBit(kObjInCanvas)) {
>             if (gROOT->GetListOfCanvases()) gROOT->GetListOfCanvases()->RecursiveRemove(this);
>             if (gROOT->GetListOfBrowsers()) gROOT->GetListOfBrowsers()->RecursiveRemove(this);
>          }
>       }
>    }
> 
>    fBits &= ~kNotDeleted;
> 
>    if (fgObjectStat && gObjectTable) gObjectTable->Remove(this);
> }
> ===============
>   I think it will be useful to change things as follows:
> 
> TObject::~TObject()
> {
>    // TObject destructor. Removes object from all "checked" lists (containers ?)
>    // if observer bit is on and remove from the global object table.
> 
>    if (gROOT) {
>       if (gROOT->MustClean()) {
>          if (gROOT == this) return;
>          if (TestBit(kInCheckedList)) {
>             TList *checked = gROOT->GetListOfCheckedContainers();
>             if (checked) {
>               TIter next(checked);
>               TList *observer = 0;
>               while (observer = (TList *)next()) 
>                 observer->RecursiveRemove(this)
>             }
>          }
>       }
>    }
> 
>    fBits &= ~kNotDeleted;
> 
>    if (fgObjectStat && gObjectTable) gObjectTable->Remove(this);
> }
> 
> 
>   This allows the user code introduce their own "check in" lists to satisfy their own needs as well not only TCanvas 
> and TBrowser.
> 
>                Valery
> =================================================================
> Dr. Valeri Faine (Fine)
>     -------------------          Phone: +1 516 344 7806
> Brookhaven National Laboratory   FAX  : +1 516 344 4206
> Bldg. 510A /STAR                 mailto:fine@bnl.gov
> Upton, New York, 11973-5000      http://nicewww.cern.ch/~fine
> USA
>                                  
> Dr. Valery Fine                  Telex : 911621 dubna su
>     -----------
> LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
> 141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
> Russia                           mailto:fine@main1.jinr.dubna.su                              
> 


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:39 MET