From a8c58f8747f4155c82bb25d81b06e8baebfcc2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 1 Dec 2023 11:52:20 +0100 Subject: [PATCH] copy the buffer to allow modifications during iteration --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 24455668188..1f92d97129f 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -376,7 +376,8 @@ void filterMenuOperations(QMenu* menu, QString filter, bool keep_from_here) buffer.append(action); while(!buffer.isEmpty()){ - for(QAction* action : buffer) { + QList buffer_copy=buffer; // make a copy as we modify buffer in the loop + for(QAction* action : buffer_copy) { if(QMenu* submenu = action->menu()) { bool keep = true;