diff --git a/include/propertyvisitors.hpp b/include/propertyvisitors.hpp index 1651f9cce56b4d91a3b338d27fc26ac7c1ccdc87..a3255b7412d74ce303049ae59ed463df66de801d 100644 --- a/include/propertyvisitors.hpp +++ b/include/propertyvisitors.hpp @@ -52,7 +52,6 @@ private: QWidget* current_widget(); void push_array_widget(const Property& prop); QWidget *pop_widget(); - NeighborhoodDialog* neighborhoodDialog; private: void visit(StringProperty& str); diff --git a/src/uibuildervisitor.cpp b/src/uibuildervisitor.cpp index 8e79de8a794653f4d4bb71a5146c99afece0067e..99a81c533226f65a77aa733e1d18749c95d9418a 100644 --- a/src/uibuildervisitor.cpp +++ b/src/uibuildervisitor.cpp @@ -202,15 +202,15 @@ void UIBuilderVisitor::visit(PropertyList &list) add_button->setEnabled(true); } }); - QObject::connect(widgetGridNeighborhoodButton, &QPushButton::pressed, [this, &list, list_widget]() { + QObject::connect(widgetGridNeighborhoodButton, &QPushButton::pressed, [&list, list_widget]() { Neighborhood currentNeighborhood = list.to_neighborhood(); - neighborhoodDialog = new NeighborhoodDialog(currentNeighborhood); + NeighborhoodDialog neighborhoodDialog(currentNeighborhood); - if( neighborhoodDialog->exec() ) { + if( neighborhoodDialog.exec() ) { //std::cout << "sacreubleu" << endl; fflush(stdout); list.clear(); - Neighborhood* newNeighborhood = neighborhoodDialog->getNeighborhood(); + Neighborhood* newNeighborhood = neighborhoodDialog.getNeighborhood(); list.load_from_neighborhood(*newNeighborhood); delete newNeighborhood; UIBuilderVisitor visit(list_widget);