1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
From: Kristian Nielsen <knielsen@knielsen-hq.org>
Date: Sun, 26 Feb 2023 15:38:42 +0100
Subject: Cherry-pick upstream fix for use-after-free crash at exit
This patch can be dropped when importing next upstream release.
Origin: https://github.com/openscad/openscad/pull/3846
Bug: https://github.com/openscad/openscad/issues/3837
Forwarded: not-needed
---
src/openscad.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/openscad.cc b/src/openscad.cc
index 6c2a00c..568ca88 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -844,7 +844,8 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
InputDriverManager::instance()->init();
int rc = app.exec();
- for (auto &mainw : scadApp->windowManager.getWindows()) delete mainw;
+ const auto &windows = scadApp->windowManager.getWindows();
+ while (!windows.empty()) delete *windows.begin();
return rc;
}
#else // OPENSCAD_QTGUI
|