From cdb72b9f3466c91f55076d84093b92bae9e793d1 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 29 May 2019 11:42:35 +0200 Subject: [PATCH 1/2] Avoid a segfault in `load_plugin` Before that patch `accepted_keywords` was a dangling reference to an object that was destroyed at the end of the constructor of the class `Polyhedron_demo`. Now, that `QStringList` is copied, but it is a short list of short strings. --- Polyhedron/demo/Polyhedron/MainWindow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index 0689df3183e..73f605ecfdf 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -454,7 +454,7 @@ private: bool bbox_need_update; QMap >plugin_metadata_map; QMap ignored_map; - const QStringList& accepted_keywords; + QStringList accepted_keywords; private: QMap action_menu_map; From ecaa13876199dbc13e4000e8e5e47e2a043f11d8 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 29 May 2019 11:44:08 +0200 Subject: [PATCH 2/2] Do not block load_plugin from loading plugins Since the adoption of the "keywords" feature, the 'Load plugin' menu was not able to load a plugin with other keywords. That defeats the purpose of that feature. --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 358d6a1ac93..36244401da4 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -362,6 +362,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren connect(&operationSearchBar, &QLineEdit::textChanged, this, &MainWindow::filterOperations); loadPlugins(); + accepted_keywords.clear(); // Setup the submenu of the View menu that can toggle the dockwidgets Q_FOREACH(QDockWidget* widget, findChildren()) {