From 3e2271256df682bdc40f826a652614df2f222e19 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@cnes.fr>
Date: Wed, 14 Feb 2018 08:25:34 +0100
Subject: [PATCH] BUG: Moving PropageRequestedRegion() at the correct place in
 ImageList, and remove the unnecessary call in PipelineMemoryPrintCalculator
 (part of fir for #1516)

---
 .../Core/ObjectList/include/otbImageList.txx  | 27 ++++++++++---------
 .../src/otbPipelineMemoryPrintCalculator.cxx  |  5 +---
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Modules/Core/ObjectList/include/otbImageList.txx b/Modules/Core/ObjectList/include/otbImageList.txx
index dc0cbc9b6f..80b7276454 100644
--- a/Modules/Core/ObjectList/include/otbImageList.txx
+++ b/Modules/Core/ObjectList/include/otbImageList.txx
@@ -33,6 +33,19 @@ ImageList<TImage>
 ::UpdateOutputData()
 {
   Superclass::UpdateOutputData();
+  for (ConstIterator it = this->Begin(); it != this->End(); ++it)
+    {
+        it.Get()->GetSource()->UpdateOutputData(it.Get());
+    }
+}
+
+template <class TImage>
+void
+ImageList<TImage>
+::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError)
+  {
+  Superclass::PropagateRequestedRegion();
+
   for (ConstIterator it = this->Begin(); it != this->End(); ++it)
     {
     if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime()
@@ -42,7 +55,7 @@ ImageList<TImage>
       if (it.Get()->GetSource())
         {
         it.Get()->GetSource()->PropagateRequestedRegion(it.Get());
-
+        
         // Check that the requested region lies within the largest possible region
         if (!it.Get()->VerifyRequestedRegion())
           {
@@ -51,22 +64,12 @@ ImageList<TImage>
           e.SetLocation(ITK_LOCATION);
           e.SetDataObject(it.Get());
           e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
-
+          
           throw e;
           }
-
-        it.Get()->GetSource()->UpdateOutputData(it.Get());
         }
       }
     }
-}
-
-template <class TImage>
-void
-ImageList<TImage>
-::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError)
-  {
-  Superclass::PropagateRequestedRegion();
   }
 
 template <class TImage>
diff --git a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx
index 3287a6c03a..d7d62e8c88 100644
--- a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx
+++ b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx
@@ -187,11 +187,8 @@ PipelineMemoryPrintCalculator
        it != imageList->End(); ++it)                                    \
        {                                                             \
        if(it.Get()->GetSource())                                        \
-         {                                                              \
-         it.Get()->PropagateRequestedRegion();                                   \
          print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource());\
-         }                                                              \
-else                                                                    \
+       else                                                             \
          print += this->EvaluateDataObjectPrint(it.Get());              \
        }                                                           \
     return print;                                                  \
-- 
GitLab