]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Leak between file openings corrected.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Aug 2009 13:03:31 +0000 (13:03 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Aug 2009 13:03:31 +0000 (13:03 +0000)
STEER/AliAODEvent.cxx
STEER/AliAODInputHandler.cxx
STEER/AliESDEvent.cxx
STEER/AliESDInputHandler.cxx

index ac076101fa2552480de452c995fe6ad27e256662..5603a210e14f6ecda718aa181b8d7c964783afa2 100644 (file)
@@ -442,8 +442,6 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
     TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("AODObjectsConnectedToTree"));
     if (connectedList && (strcmp(opt, "reconnect"))) {
        // If connected use the connected list of objects
-       printf("Delete and reconnect \n");
-       
        fAODObjects->Delete();
        fAODObjects = connectedList;
        GetStdContent(); 
@@ -453,12 +451,11 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
     // Connect to tree
     // prevent a memory leak when reading back the TList
     if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete();
-    delete fAODObjects;
-    fAODObjects = 0;
+
     // create a new TList from the UserInfo TList... 
     // copy constructor does not work...
     fAODObjects = (TList*)(aodEvent->GetList()->Clone());
-    fAODObjects->SetOwner(kFALSE);
+    fAODObjects->SetOwner(kTRUE);
     if(fAODObjects->GetEntries()<kAODListN){
       printf("%s %d AliAODEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
             (char*)__FILE__,__LINE__,fAODObjects->GetEntries(),kAODListN);
@@ -513,7 +510,7 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
     GetStdContent();
     // when reading back we are not owner of the list 
     // must not delete it
-    fAODObjects->SetOwner(kFALSE);
+    fAODObjects->SetOwner(kTRUE);
     fAODObjects->SetName("AODObjectsConnectedToTree");
     // we are not owner of the list objects 
     // must not delete it
@@ -533,7 +530,7 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
     GetStdContent();
     // when reading back we are not owner of the list 
     // must not delete it
-    fAODObjects->SetOwner(kFALSE);
+    fAODObjects->SetOwner(kTRUE);
   }
 }
 
index 7414c643e9c97c614e3b39cf03589a7d2b58e221..1c0cda99cfd2bf1e514002f165a89940a0d6711c 100644 (file)
@@ -90,11 +90,7 @@ Bool_t AliAODInputHandler::Init(TTree* tree, Option_t* /*opt*/)
     SwitchOnBranches();
     
     // Get pointer to AOD event
-    if (fEvent) {
-      delete fEvent;
-      fEvent = 0;
-    }
-    fEvent = new AliAODEvent();
+    if (!fEvent) fEvent = new AliAODEvent();
 
     fEvent->ReadFromTree(fTree);
     return kTRUE;
index 947532312279273bb6097071cac867d61c4db0b6..116f5dd64bc9d5b351bdc3485bc40dbc86630c93 100644 (file)
@@ -1439,7 +1439,7 @@ void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){
     GetStdContent();
     // when reading back we are not owner of the list 
     // must not delete it
-    fESDObjects->SetOwner(kFALSE);
+    fESDObjects->SetOwner(kTRUE);
   }
 }
 
index aafc5a35d13526b8466e7394d487399989c55a72..b0ec64a92d6a0d2f77b0a472646dc5eba9a9918d 100644 (file)
@@ -87,7 +87,6 @@ Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* opt)
     SwitchOnBranches();
     
     if (!fEvent) fEvent = new AliESDEvent();
-
     fEvent->ReadFromTree(fTree);
     fNEvents = fTree->GetEntries();
 
@@ -102,11 +101,10 @@ Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* opt)
            fHLTEvent = 0;
        }
        if (fHLTTree) {
-           fHLTEvent = new AliESDEvent();
-           fHLTEvent->ReadFromTree(fHLTTree);
+         if (!fHLTEvent) fHLTEvent = new AliESDEvent();
+         fHLTEvent->ReadFromTree(fHLTTree);
        }
     }
-    
     return kTRUE;
 }