[vtkusers] VTK 6.2.0 Bug in vtkVRMLImporter, example crashes if there are more than one instance of vtkVRMLImporter
Arnaud Gelas
arnaudgelas at gmail.com
Tue Apr 7 07:39:29 EDT 2015
Hi all,
We have slightly modified the following wiki example:
http://www.itk.org/Wiki/VTK/Examples/Cxx/IO/VRML <http://www.itk.org/Wiki/VTK/Examples/Cxx/IO/VRML>
As follows:
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkVRMLImporter.h>
#include <vtkDataSet.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
int main ( int argc, char *argv[])
{
if(argc != 2)
{
std::cout << "Required arguments: Filename" << std::endl;
return EXIT_FAILURE;
}
std::string filename = argv[1];
std::cout << "Reading " << filename << std::endl;
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
// VRML Import
vtkSmartPointer<vtkVRMLImporter> importer = vtkSmartPointer<vtkVRMLImporter>::New();
importer->SetFileName ( filename.c_str() );
importer->SetRenderWindow(renderWindow);
importer->Update();
renderWindow->Render();
renderWindowInteractor->Start();
vtkSmartPointer<vtkRenderer> renderer2 = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow2 = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow2->AddRenderer(renderer2);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor2 = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor2->SetRenderWindow(renderWindow2);
// VRML Import
vtkSmartPointer<vtkVRMLImporter> importer2 = vtkSmartPointer<vtkVRMLImporter>::New();
importer2->SetFileName ( filename.c_str() );
importer2->SetRenderWindow(renderWindow2);
importer2->Update();
renderWindow2->Render();
renderWindowInteractor2->Start();
return EXIT_SUCCESS;
}
As you can see the modification is quite simple, we have just created 2 instances of every objects…
This naive example crashes when exiting (trying to delete the second importer, i.e. importer2).
Any idea what could go wrong? and how to fix this bug?
Thanks in advance,
Best regards
Arnaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150407/2905bfc4/attachment.html>
More information about the vtkusers
mailing list