File: Cherry-pick-upstream-fix-for-use-after-free-crash-at-exit.patch

package info (click to toggle)
openscad 2021.01-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 36,096 kB
  • sloc: cpp: 53,199; sh: 4,384; ansic: 4,382; python: 1,813; yacc: 853; javascript: 762; lex: 417; lisp: 163; xml: 127; makefile: 118
file content (27 lines) | stat: -rw-r--r-- 945 bytes parent folder | download | duplicates (3)
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