From 33e35f5d446f2bd4060f8aebbead2d72c99e048c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 30 Jul 2015 12:24:10 +0200 Subject: [PATCH 1/2] SEGFAULT Fix - when deleting a Scene_edit_polyhedron_item WHILE manipulating a frame, a segfault occured because a bad manipulated frame was sent to the viewer. Calling setVisible(false) in the destructor of the item calls setManipulatedFrame(NULL) and fixex the problem. --- Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.cpp index a66f0a224e2..0a0144cf4d2 100644 --- a/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_edit_polyhedron_item.cpp @@ -110,6 +110,7 @@ Scene_edit_polyhedron_item::Scene_edit_polyhedron_item Scene_edit_polyhedron_item::~Scene_edit_polyhedron_item() { + setVisible(false); while(is_there_any_ctrl_vertices_group()) { delete_ctrl_vertices_group(false); From bc21fe6ad743acd74e10dd3bcee07eaf9e219bf3 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 30 Jul 2015 18:45:09 +0200 Subject: [PATCH 2/2] Use findChild to get the pointer to Viewer Should fix #218, because the class MainWindow is no longer used. --- Mesh_3/demo/Mesh_3/MainWindow.h | 2 -- Mesh_3/demo/Mesh_3/Volume_planes_plugin.cpp | 8 ++------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Mesh_3/demo/Mesh_3/MainWindow.h b/Mesh_3/demo/Mesh_3/MainWindow.h index 4b597677ced..a5fc53d55b5 100644 --- a/Mesh_3/demo/Mesh_3/MainWindow.h +++ b/Mesh_3/demo/Mesh_3/MainWindow.h @@ -33,8 +33,6 @@ public: MainWindow(QWidget* parent = 0); ~MainWindow(); - Viewer* getViewer() { return viewer; } - public Q_SLOTS: void updateViewerBBox(); void open(QString filename); diff --git a/Mesh_3/demo/Mesh_3/Volume_planes_plugin.cpp b/Mesh_3/demo/Mesh_3/Volume_planes_plugin.cpp index f4b4aea3612..37b9a8c1951 100644 --- a/Mesh_3/demo/Mesh_3/Volume_planes_plugin.cpp +++ b/Mesh_3/demo/Mesh_3/Volume_planes_plugin.cpp @@ -13,7 +13,6 @@ #include #include #include -#include "MainWindow.h" #include #include @@ -173,11 +172,8 @@ public: connect(planeSwitch, SIGNAL(triggered()), this, SLOT(selectPlanes())); // evil - MainWindow* mwTmp; - if( !(mwTmp = dynamic_cast(mw)) ) { - std::cerr << "Volume_planes_plugin cannot init mousegrabber" << std::endl; - } - Viewer* v = mwTmp->getViewer(); + Viewer* v = mw->findChild("viewer"); + CGAL_assertion(v != 0); pxr_.setViewer(v); connect(v, SIGNAL(pointSelected(QPoint)), &pxr_, SLOT(update(QPoint)));