Package: camitk / 4.1.2-3

0010-Make-loop-safe-for-removal-of-elements.patch Patch series | download
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
28
29
30
31
32
33
From 52f172e553ebddf068b8e35601da5eefd295cf3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu@mailbox.org>
Date: Thu, 20 Sep 2018 17:42:14 +0200
Subject: [PATCH] Make loop safe for removal of elements.

Bug-Debian: https://bugs.debian.org/909120
Forwarded: no
Last-Update: 2018-09-20

---
 modeling/libraries/pml/MultiComponent.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modeling/libraries/pml/MultiComponent.cpp b/modeling/libraries/pml/MultiComponent.cpp
index 5a3a9ab..3f32d7b 100644
--- a/modeling/libraries/pml/MultiComponent.cpp
+++ b/modeling/libraries/pml/MultiComponent.cpp
@@ -46,8 +46,10 @@ MultiComponent::~MultiComponent() {
 
 // ------------------ deleteAllSubComponents ---------------------
 void MultiComponent::deleteAllSubComponents() {
-    for (auto& component : components) {
-        delete component;
+    auto component = components.begin();
+    while (component != components.end()) {
+        delete *component;
+        component = components.begin();
     }
     components.clear();
 }
-- 
2.18.0