From 57809da6a44addebed649e4b8dba44cbe68c4ab7 Mon Sep 17 00:00:00 2001
From: Gerardo Ganis <Gerardo.Ganis@cern.ch>
Date: Thu, 8 May 2008 09:44:00 +0000
Subject: [PATCH] Remove the 'MissingFiles' list from all the input list copies

git-svn-id: http://root.cern.ch/svn/root/trunk@23752 27541ba8-7e3a-0410-8455-c3a389f83636
---
 proof/proof/src/TProofServ.cxx         | 9 +++++++--
 proof/proofplayer/src/TProofPlayer.cxx | 4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/proof/proof/src/TProofServ.cxx b/proof/proof/src/TProofServ.cxx
index cb64390d63d..0d7b58afbb3 100644
--- a/proof/proof/src/TProofServ.cxx
+++ b/proof/proof/src/TProofServ.cxx
@@ -3537,11 +3537,15 @@ void TProofServ::HandleProcess(TMessage *mess)
 
          // Set input
          TIter next(input);
-         for (TObject *o; (o = next()); ) {
+         TObject *o = 0;
+         while ((o = next())) {
             PDB(kGlobal, 2) Info("HandleProcess", "adding: %s", o->GetName());
             fPlayer->AddInput(o);
          }
 
+         // Remove the list of the missing files from the original list, if any
+         if ((o = input->FindObject("MissingFiles"))) input->Remove(o);
+
          // Process
          PDB(kGlobal, 1) Info("HandleProcess", "calling %s::Process()", fPlayer->IsA()->GetName());
          fPlayer->Process(dset, filename, opt, nentries, first);
@@ -3656,7 +3660,8 @@ void TProofServ::HandleProcess(TMessage *mess)
 
       // Set input
       TIter next(input);
-      for (TObject *o; (o = next()); ) {
+      TObject *o = 0;
+      while ((o = next())) {
          PDB(kGlobal, 2) Info("HandleProcess", "adding: %s", o->GetName());
          fPlayer->AddInput(o);
       }
diff --git a/proof/proofplayer/src/TProofPlayer.cxx b/proof/proofplayer/src/TProofPlayer.cxx
index 7b0802f46a7..ab395becf79 100644
--- a/proof/proofplayer/src/TProofPlayer.cxx
+++ b/proof/proofplayer/src/TProofPlayer.cxx
@@ -219,6 +219,7 @@ TProofPlayer::~TProofPlayer()
 
    fInput->Clear("nodelete");
    SafeDelete(fInput);
+   SafeDelete(fOutput);      // owns the output list
    SafeDelete(fSelector);
    SafeDelete(fFeedbackTimer);
    SafeDelete(fEvIter);
@@ -1215,7 +1216,8 @@ Long64_t TProofPlayerRemote::Process(TDSet *dset, const char *selector_file,
          // A list for the missing files may already have been added to the
          // output list; otherwise, if needed it will be created inside
          if ((listOfMissingFiles = (TList *)fInput->FindObject("MissingFiles"))) {
-            // Move it to the output list
+            // The list will be registered into the output list:
+            // remove it from the input list to avoid problems at destruction
             fInput->Remove(listOfMissingFiles);
          } else {
             listOfMissingFiles = new TList;
-- 
GitLab