[vtkusers] Segmentation fault when using algorithm output returned from function

zmurphy zmurphy1125 at gmail.com
Thu May 18 15:15:42 EDT 2017


I have a class with a function which returns a vtkSmartPointer with a
vtkAlgorithmOutput inside.
When attempting to pass this to an vtkAppendPolyData, I receive a
segmentation fault.
Below is an example.

class MyClass {
    public:
        void setup() {
            //Do things to set up data
            _data = append->GetOutputPort(); //In this case, append is a
different AppendPolyData
        }

        vtkSmartPointer<vtkAlgorithmOutput> output() { return _data; }

    protected:

        vtkSmartPointer<vtkAlgorithmOutput> _data;
}

Then in a different object which uses that class:

vtkSmartPointer<vtkAppendPolyData> collection =
vtkSmartPointer<vtkAppendPolyData>::New();

for (auto& data : vectorOfMyClassObjects) {
    collection->AddInputConnection(data->output()); //Where the segfault
happens
}

Does anyone know what might cause this or of any tips on how to diagnose it?
I've run it through gdb to find where the segfault happens, but beyond that,
I'm not sure what's wrong.




--
View this message in context: http://vtk.1045678.n5.nabble.com/Segmentation-fault-when-using-algorithm-output-returned-from-function-tp5743320.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list