Found a workaround for Issue 5 to avoid segmentation faults. The data included in the created window are cleared, but the window itself is not destroyed, only when its parent is deleted -> here the MainWindow. It seems that child CloudViewer windows don't crash when deleted on application exit.

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1826 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-10-02 19:33:51 +00:00
parent 2badfb5faf
commit 0a807e8cde
6 changed files with 32 additions and 15 deletions

View File

@@ -3056,8 +3056,7 @@ void MainWindow::viewScans()
std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr> scans;
if(getExportedScans(scans))
{
QWidget * window = new QWidget(this, Qt::Window);
window->setAttribute(Qt::WA_DeleteOnClose);
QDialog * window = new QDialog(this, Qt::Window);
window->setWindowFlags(Qt::Dialog);
window->setWindowTitle(tr("Scans (%1 nodes)").arg(scans.size()));
window->setMinimumWidth(800);
@@ -3069,6 +3068,7 @@ void MainWindow::viewScans()
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(viewer);
window->setLayout(layout);
connect(window, SIGNAL(finished(int)), viewer, SLOT(clear()));
window->show();
@@ -3208,8 +3208,7 @@ void MainWindow::viewClouds()
if(getExportedClouds(clouds, meshes, false))
{
QWidget * window = new QWidget(this, Qt::Window);
window->setAttribute(Qt::WA_DeleteOnClose);
QDialog * window = new QDialog(this, Qt::Window);
if(meshes.size())
{
window->setWindowTitle(tr("Meshes (%1 nodes)").arg(meshes.size()));
@@ -3227,6 +3226,7 @@ void MainWindow::viewClouds()
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(viewer);
window->setLayout(layout);
connect(window, SIGNAL(finished(int)), viewer, SLOT(clear()));
window->show();