I do not have VTK to work with, so I am working from this example:
http://www.vtk.org/Wiki/VTK/Examples...gleInheritance
It seems that you are creating an unnecessary vtkRenderWindow with this line:
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
To copy to clipboard, switch view to plain text mode
that you attach the renderer to with:
renderWindow->AddRenderer(renderer);
renderWindow->AddRenderer(renderer);
To copy to clipboard, switch view to plain text mode
You later add the same renderer instance to your widget
ui->vtkwidget->GetRenderWindow()->AddRenderer(renderer);// crash
ui->vtkwidget->GetRenderWindow()->AddRenderer(renderer);// crash
To copy to clipboard, switch view to plain text mode
I suspect that the unused vtkRenderWindow is taking the renderer with it when its smart pointer goes out of scope. Then the widget crashes later when it tries to use it. Try commenting both the lines I identified.
Bookmarks