I m using Ubuntu 20.04 with Qt5.12 for developing a QT project which uses a QVTK widget to display a 3D PCL visualiser. I m facing memory leak issues after defining the visualiser and vtk widget relationship. The header file contents are as follows:
class SiLS : public QMainWindow
{
Q_OBJECT
public:
SiLS(QWidget *parent = nullptr);
~SiLS();
private:
Ui::SiLS *ui;
pcl::visualization::PCLVisualizer::Ptr viewer_3D;
};
The cpp file contents are as follows:
SiLS::SiLS(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::SiLS)
{
ui->setupUi(this);
viewer_3D.reset (new pcl::visualization::PCLVisualizer ("viewer_3D", false));
viewer_3D->setupInteractor (ui->qvtkWidget->GetInteractor (), ui->qvtkWidget->GetRenderWindow ());
ui->qvtkWidget->SetRenderWindow(viewer_3D->getRenderWindow());
}
SiLS::~SiLS()
{
delete ui;
}
Only these 3 lines of code in the constructor is giving lot of memory leak issues. How to destruct the qvtkwidget properly?