vtkAlgorithmOutput.GetProducer segfaults in Python when returned from different scope
When using the output port, vtkAlgorithmOutput
, of a an algorithm that was fetched from a different scope, segfaults occur. For example:
This works fine:
import vtk
source = vtk.vtkRTAnalyticSource()
alg = vtk.vtkDataSetSurfaceFilter()
alg.SetInputConnection(source.GetOutputPort())
output = alg.GetOutputPort()
output.GetProducer()
But if I put the filtering logic in a function and return the vtkAlgorithmOutput
, then a segfault occurs when calling GetProducer()
on the object:
import vtk
def filter(inp):
alg = vtk.vtkDataSetSurfaceFilter()
alg.SetInputConnection(inp.GetOutputPort())
return alg.GetOutputPort()
source = vtk.vtkRTAnalyticSource()
output = filter(source)
output.GetProducer() # <- segfaults