QVTKWidget SetRenderWindow() with PCLVisualizer Exception

0

I'm new in PCL. I want to build a project with PCL and VTK int Qt 5.9.6 MSVC 2017 64bit Environment.

My code is like this:

// include file
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;

...

// source code file
viewer.reset(new pcl:visualization::PCLVisualizer("viewer", false));
ui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
viewer->setupInteractor(ui->qvtkWidget->GetInteractor(), ui->qvtkWidget- >GetRenderWindow());

It can be compiled but when I started debugging it goes wrong with alert:

The inferior stopped because it triggered an exception. Stopped in thread 0 by: Exception at 0x7ffcb50b1f28, code: 0xc0000005: read access violation at 0x25, flags=0x0 (first chance).

and stopped at lineui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());

After tracking and debugging, I found the problem is that viewer->getRenderWindow()->GetInteractor() get the 0x25 value, I don't know how that could happen because a lot of online examples use code like this. And the same program runs healthy on ubuntu 18.04.

Thanks for any tips.

c++
qt
vtk
point-cloud-library
asked on Stack Overflow Aug 15, 2018 by Jun.Tao

1 Answer

0

In the end, I found out that this is a problem caused by the version of VTK. The original version is 8.1.1, and it can be run normally by switching to 8.0.1. But I don't know why it can still be debugged normally in Linux 8.1.1.

answered on Stack Overflow Aug 16, 2018 by Jun.Tao

User contributions licensed under CC BY-SA 3.0