Wanted: TObject dtor improvement

From: Valery Fine (fine@bnl.gov)
Date: Fri Nov 13 1998 - 20:43:58 MET


  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                              



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