Changeset 8283


Ignore:
Timestamp:
02/01/07 12:49:29 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MStatusArray.cc

    r7784 r8283  
    247247// --------------------------------------------------------------------------
    248248//
     249// Make sure that kCanDelete is properly set for all directly contained
     250// objects. Some kCanDelete bits might not be properly set or get lost when
     251// the MParContainer is stored.
     252//
     253void MStatusArray::SetCanDelete(const TCollection *list) const
     254{
     255    TIter Next(list);
     256    TObject *o=0;
     257    while ((o=Next()))
     258    {
     259        if (o->InheritsFrom(TVirtualPad::Class()))
     260            SetCanDelete(((TVirtualPad*)o)->GetListOfPrimitives());
     261        else
     262            o->SetBit(kCanDelete);
     263    }
     264}
     265
     266// --------------------------------------------------------------------------
     267//
    249268// Switch off adding histograms to current directory before reading.
    250269// Switch back
     
    252271Int_t MStatusArray::Read(const char *name)
    253272{
     273    // It seems that the contents are not properly deleted by TObjArray::Read
     274    Delete();
     275
     276    // Make sure newly read histograms are not added to the current directory
    254277    const Bool_t store = TH1::AddDirectoryStatus();
    255278    TH1::AddDirectory(kFALSE);
    256279    const Int_t rc = TObjArray::Read(name?name:"MStatusDisplay");
    257280    TH1::AddDirectory(store);
     281
     282    // Make sure that all kCanDelete bits are properly set
     283    SetCanDelete(this);
     284
    258285    return rc;
    259286}
  • trunk/MagicSoft/Mars/mbase/MStatusArray.h

    r7808 r8283  
    1515{
    1616private:
     17    void     SetCanDelete(const TCollection *list) const;
    1718    void     PrintObjectsInPad(const TCollection *list, const TString &name, Int_t lvl=0) const;
    1819    TObject *FindObjectInPad(TVirtualPad *pad, const char *object, TClass *base) const;
Note: See TracChangeset for help on using the changeset viewer.