summarylogtreecommitdiffstats
path: root/issue710.patch
blob: 1e1806aace451b2e70d6ba12f45455b530941638 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--- qucs-core/src/net.cpp
+++ qucs-core/src/net.cpp
@@ -350,7 +350,13 @@ void net::orderAnalysis (void) {
 void net::sortChildAnalyses (analysis * parent) {
   ptrlist<analysis> * alist = parent->getAnalysis ();
   if (alist != nullptr) {
-    for (auto *a: *alist) {
+
+    for (auto it = alist->begin(); it != alist->end(); /* empty */) {
+      // Copy the value of the element (a pointer), and advance the
+      // iterator prior to manipulating the list.
+      analysis *a = *it;
+      ++it;
+
       if (a->getType () == ANALYSIS_DC
 	  || containsAnalysis (a, ANALYSIS_DC)) {
 	parent->delAnalysis (a);