Commit 57907496 authored by Mathieu Malaterre's avatar Mathieu Malaterre
Browse files

ExecuteInformation / ExecuteData should return on error

Need also to make sure error is cleared out before Execute

Change-Id: I9319a36f432472f8ad240371118183a1014a6906
parent 51afa1c4
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "vtkImageData.h" #include "vtkImageData.h"
#include "vtkInformation.h" #include "vtkInformation.h"
#include "vtkInformationVector.h" #include "vtkInformationVector.h"
#include "vtkErrorCode.h"
#include "vtkStreamingDemandDrivenPipeline.h" #include "vtkStreamingDemandDrivenPipeline.h"
...@@ -72,6 +73,7 @@ int vtkImageAlgorithm::RequestData( ...@@ -72,6 +73,7 @@ int vtkImageAlgorithm::RequestData(
vtkInformation *outInfo = vtkInformation *outInfo =
outputVector->GetInformationObject(outputPort); outputVector->GetInformationObject(outputPort);
// call ExecuteData // call ExecuteData
this->SetErrorCode( vtkErrorCode::NoError );
if (outInfo) if (outInfo)
{ {
this->ExecuteData( outInfo->Get(vtkDataObject::DATA_OBJECT()) ); this->ExecuteData( outInfo->Get(vtkDataObject::DATA_OBJECT()) );
...@@ -80,6 +82,12 @@ int vtkImageAlgorithm::RequestData( ...@@ -80,6 +82,12 @@ int vtkImageAlgorithm::RequestData(
{ {
this->ExecuteData(NULL); this->ExecuteData(NULL);
} }
// Check for any error set by downstream filter (IO in most case)
if ( this->GetErrorCode() )
{
return 0;
}
return 1; return 1;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "vtkInformationVector.h" #include "vtkInformationVector.h"
#include "vtkObjectFactory.h" #include "vtkObjectFactory.h"
#include "vtkPointData.h" #include "vtkPointData.h"
#include "vtkErrorCode.h"
#include "vtkStreamingDemandDrivenPipeline.h" #include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkStringArray.h" #include "vtkStringArray.h"
...@@ -508,8 +509,14 @@ int vtkImageReader2::RequestInformation ( ...@@ -508,8 +509,14 @@ int vtkImageReader2::RequestInformation (
vtkInformationVector** vtkNotUsed( inputVector ), vtkInformationVector** vtkNotUsed( inputVector ),
vtkInformationVector * outputVector) vtkInformationVector * outputVector)
{ {
this->SetErrorCode( vtkErrorCode::NoError );
// call for backwards compatibility // call for backwards compatibility
this->ExecuteInformation(); this->ExecuteInformation();
// Check for any error set by downstream filter (IO in most case)
if ( this->GetErrorCode() )
{
return 0;
}
// get the info objects // get the info objects
vtkInformation* outInfo = outputVector->GetInformationObject(0); vtkInformation* outInfo = outputVector->GetInformationObject(0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment