Hello all,
I tried to reproduce this issue.

Unfortunately I never get the "(SEGFAULT)" output for all tests,
just "(Failed)" for most. But some do really segfault in my amd64 VM.

I think the segfaults are caused by the line "delete component;", that
invalidates the iterator by removing its element from the components vector.

For some reason the iterator contains still the previous pointer
and therefore we try to delete the same pointer twice.


Attached patch tries to change the loop assuming that the
deleted element will always be removed inside the delete operation.

With that patch I do not get any segfault, but still tests
fail for some reason.


Kind regards,
Bernhard




# Here we crash:

(gdb) bt
#0  0x0000000000000061 in ?? ()
#1  0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
#2  0x00007fffeb32c11f in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:41
#3  0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#4  0x00007fffeb32ce3a in PhysicalModel::clear (this=this@entry=0x555555705ef0) 
at ./modeling/libraries/pml/PhysicalModel.cpp:99
#5  0x00007fffeb32cf17 in PhysicalModel::~PhysicalModel (this=0x555555705ef0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:68
#6  0x00007fffeb32cf59 in PhysicalModel::~PhysicalModel (this=0x555555705ef0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:67
#7  0x00007fffeb317a3d in PMLComponent::~PMLComponent (this=0x555555660a00, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:96
#8  0x00007fffeb3185a9 in PMLComponent::~PMLComponent (this=0x555555660a00, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:93
#9  0x00007ffff7ec4ad7 in camitk::Application::close(camitk::Component*) () at 
./sdk/libraries/core/application/Application.cpp:623
#10 0x000055555555bc5c in main () at 
./sdk/applications/testcomponents/main.cpp:204
#11 0x00007ffff6e99b17 in __libc_start_main (main=0x55555555b080 <main>, 
argc=9, argv=0x7fffffffe398, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffe388) at ../csu/libc-start.c:310
#12 0x000055555555c35a in _start () at 
./sdk/applications/testcomponents/main.cpp:136

(gdb) list -
46
47      // ------------------ deleteAllSubComponents ---------------------
48      void MultiComponent::deleteAllSubComponents() {
49          for (auto& component : components) {
50              delete component;
51          }
52          components.clear();
53      }




# Here the pointer being deleted is removed from the components vector
# and that way invalidating the iterator.

(gdb) bt
#0  MultiComponent::removeSubComponent (c=0x5555579d70f0, this=0x555556d98330) 
at ./modeling/libraries/pml/MultiComponent.h:134
#1  Component::removeFromParents() () at 
./modeling/libraries/pml/Component.cpp:60
#2  0x00007fffeb32c127 in MultiComponent::~MultiComponent (this=0x5555579d70f0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:44
#3  0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x5555579d70f0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#4  0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
#5  0x00007fffeb32c11f in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:41
#6  0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#7  0x00007fffeb32ce3a in PhysicalModel::clear (this=this@entry=0x555555705ef0) 
at ./modeling/libraries/pml/PhysicalModel.cpp:99
...

(gdb) list modeling/libraries/pml/MultiComponent.h:134
129     }
130     inline void MultiComponent::removeSubComponent(Component* c) {
131         auto it = std::find(components.begin(), components.end(), c);
132         if (it != components.end()) {
133             components.erase(it);
134             c->removeParentMultiComponent(this);
135         }
136     }
From 52f172e553ebddf068b8e35601da5eefd295cf3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernha...@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

apt build-dep camitk
apt install mc systemd-coredump fakeroot gdb valgrind git

mkdir camitk/orig -p
cd    camitk/orig
apt source camitk
cd ../..


cd camitk
cp -a orig try1
cd try1/camitk-4.1.2
dpkg-buildpackage






[Do Sep 20 14:40:07 2018] camitk-testcomp[13880]: segfault at 61 ip 
0000000000000061 sp 00007ffd2faf02b8 error 14 in 
camitk-testcomponents[5558b0632000+6000]
[Do Sep 20 14:40:07 2018] Code: Bad RIP value.
[Do Sep 20 14:40:13 2018] camitk-pmltest[14203]: segfault at 61 ip 
0000000000000061 sp 00007ffc12fe0378 error 14 in 
camitk-pmltest[5646aa3bd000+32000]
[Do Sep 20 14:40:13 2018] Code: Bad RIP value.
[Do Sep 20 14:40:13 2018] camitk-pmltest[14209]: segfault at 60 ip 
0000000000000060 sp 00007fff1e99c318 error 14 in 
camitk-pmltest[5555ba7f8000+32000]
[Do Sep 20 14:40:13 2018] Code: Bad RIP value.
[Do Sep 20 15:00:33 2018] camitk-testcomp[6725]: segfault at 61 ip 
0000000000000061 sp 00007ffec31045f8 error 14 in 
camitk-testcomponents[55918d497000+6000]
[Do Sep 20 15:00:33 2018] Code: Bad RIP value.
[Do Sep 20 15:00:35 2018] camitk-pmltest[6962]: segfault at 61 ip 
0000000000000061 sp 00007ffce42fdcf8 error 14 in 
camitk-pmltest[55c3677ad000+32000]
[Do Sep 20 15:00:35 2018] Code: Bad RIP value.
[Do Sep 20 15:00:35 2018] camitk-pmltest[6968]: segfault at 60 ip 
0000000000000060 sp 00007ffc63c40758 error 14 in 
camitk-pmltest[56436f528000+32000]
[Do Sep 20 15:00:35 2018] Code: Bad RIP value.

root@debian:~# coredumpctl list
TIME                            PID   UID   GID SIG COREFILE  EXE
Thu 2018-09-20 14:40:08 CEST  13880  1000  1000  11 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents
Thu 2018-09-20 14:40:14 CEST  14203  1000  1000  11 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-pmltest
Thu 2018-09-20 14:40:14 CEST  14209  1000  1000  11 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-pmltest
-- Thu 2018-09-20 14:41:32 CEST  18340  1000  1000   6 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testloggercrash
Thu 2018-09-20 15:00:34 CEST   6725  1000  1000  11 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents
Thu 2018-09-20 15:00:36 CEST   6962  1000  1000  11 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-pmltest
Thu 2018-09-20 15:00:36 CEST   6968  1000  1000  11 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-pmltest
-- Thu 2018-09-20 15:00:50 CEST   9671  1000  1000   6 present   
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testloggercrash



directory /home/benutzer/camitk/try1/camitk-4.1.2
set height 0
set width 0
set pagination off
b MultiComponent::deleteAllSubComponents

coredumpctl gdb 13880
Core was generated by 
`/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents'.
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) bt
#0  0x0000000000000061 in ?? ()
#1  0x00007f43f27340d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x5558b3645390) at 
./modeling/libraries/pml/MultiComponent.cpp:50
#2  0x00007f43f273411f in MultiComponent::~MultiComponent (this=0x5558b3645390, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:41
#3  0x00007f43f2734149 in MultiComponent::~MultiComponent (this=0x5558b3645390, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#4  0x00007f43f2734e3a in PhysicalModel::clear (this=this@entry=0x5558b1eae860) 
at ./modeling/libraries/pml/PhysicalModel.cpp:99
#5  0x00007f43f2734f17 in PhysicalModel::~PhysicalModel (this=0x5558b1eae860, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:68
#6  0x00007f43f2734f59 in PhysicalModel::~PhysicalModel (this=0x5558b1eae860, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:67
#7  0x00007f43f271fa3d in PMLComponent::~PMLComponent (this=0x5558b1eaf460, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:96
#8  0x00007f43f27205a9 in PMLComponent::~PMLComponent (this=0x5558b1eaf460, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:93
#9  0x00007f43ff2ccad7 in camitk::Application::close(camitk::Component*) () at 
./sdk/libraries/core/application/Application.cpp:623
#10 0x00005558b0639c5c in main () at 
./sdk/applications/testcomponents/main.cpp:204
#11 0x00007f43fe2a1b17 in __libc_start_main (main=0x5558b0639080 <main>, 
argc=9, argv=0x7ffd2faf0718, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7ffd2faf0708) at ../csu/libc-start.c:310
#12 0x00005558b063a35a in _start () at 
./sdk/applications/testcomponents/main.cpp:136

(gdb) print argv[0]
$4 = 0x7ffd2faf2902 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents"
(gdb) print argv[1]
$5 = 0x7ffd2faf2951 "-i"
(gdb) print argv[2]
$6 = 0x7ffd2faf2954 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml"
(gdb) print argv[3]
$7 = 0x7ffd2faf29b1 "-c"
(gdb) print argv[4]
$8 = 0x7ffd2faf29b4 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so"
(gdb) print argv[5]
$9 = 0x7ffd2faf2a16 "-l"
(gdb) print argv[6]
$10 = 0x7ffd2faf2a19 "2"
(gdb) print argv[7]
$11 = 0x7ffd2faf2a1b "-o"
(gdb) print argv[8]
$12 = 0x7ffd2faf2a1e 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2"
(gdb) print argv[9]
$13 = 0x0





Xvfb
export DISPLAY=:0
export LD_LIBRARY_PATH=/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib
gdb -q --args 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2

Reading symbols from 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents...done.
(gdb) run
Starting program: 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
camitk-testcomponents run with arguments:
- component library file: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so"
- input test file: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml"
- level of test: "2"
- output directory: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2"
Starting the camitk default application...
[New Thread 0x7fffec502700 (LWP 9777)]
[New Thread 0x7fffebbc5700 (LWP 9779)]
[OK]
Loading extension: 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so...
    Loaded extension: PML Component (<b>New PML COMPONENT!</b>). Managed 
extension:pml
[OK]
Opening component: truthcube.pml...
[New Thread 0x7fffe2854700 (LWP 9782)]
[New Thread 0x7fffe2053700 (LWP 9783)]
[New Thread 0x7fffe1852700 (LWP 9784)]
[New Thread 0x7fffe1051700 (LWP 9785)]
[New Thread 0x7fffe0850700 (LWP 9786)]
[New Thread 0x7fffc3fff700 (LWP 9787)]
[New Thread 0x7fffc37fe700 (LWP 9788)]
[New Thread 0x7fffc2ffd700 (LWP 9789)]
[OK]
Saving component to: truthcube.pml...
[OK]
Closing component: truthcube.pml...

Thread 1 "camitk-testcomp" received signal SIGSEGV, Segmentation fault.
0x0000000000000061 in ?? ()

(gdb) bt
#0  0x0000000000000061 in ?? ()
#1  0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d97e90) at 
./modeling/libraries/pml/MultiComponent.cpp:50
#2  0x00007fffeb32c11f in MultiComponent::~MultiComponent (this=0x555556d97e90, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:41
#3  0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x555556d97e90, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#4  0x00007fffeb32ce3a in PhysicalModel::clear (this=this@entry=0x555555624690) 
at ./modeling/libraries/pml/PhysicalModel.cpp:99
#5  0x00007fffeb32cf17 in PhysicalModel::~PhysicalModel (this=0x555555624690, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:68
#6  0x00007fffeb32cf59 in PhysicalModel::~PhysicalModel (this=0x555555624690, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:67
#7  0x00007fffeb317a3d in PMLComponent::~PMLComponent (this=0x5555555bb1c0, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:96
#8  0x00007fffeb3185a9 in PMLComponent::~PMLComponent (this=0x5555555bb1c0, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:93
#9  0x00007ffff7ec4ad7 in camitk::Application::close(camitk::Component*) () at 
./sdk/libraries/core/application/Application.cpp:623
#10 0x000055555555bc5c in main () at 
./sdk/applications/testcomponents/main.cpp:204
#11 0x00007ffff6e99b17 in __libc_start_main (main=0x55555555b080 <main>, 
argc=9, argv=0x7fffffffe398, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffe388)
    at ../csu/libc-start.c:310
#12 0x000055555555c35a in _start () at 
./sdk/applications/testcomponents/main.cpp:136







Xvfb
export DISPLAY=:0
export LD_LIBRARY_PATH=/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib
valgrind 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2
==10030== Memcheck, a memory error detector
==10030== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==10030== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==10030== Command: 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2
==10030== 
--10030-- WARNING: unhandled amd64-linux syscall: 332
--10030-- You may be able to write your own handler.
--10030-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--10030-- Nevertheless we consider this a bug.  Please report
--10030-- it at http://valgrind.org/support/bug_reports.html.
camitk-testcomponents run with arguments:
- component library file: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so"
- input test file: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml"
- level of test: "2"
- output directory: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2"
Starting the camitk default application...
==10032== 
==10032== HEAP SUMMARY:
==10032==     in use at exit: 461,568 bytes in 4,314 blocks
==10032==   total heap usage: 7,236 allocs, 2,922 frees, 1,125,942 bytes 
allocated
==10032== 
==10032== LEAK SUMMARY:
==10032==    definitely lost: 2,080 bytes in 3 blocks
==10032==    indirectly lost: 51 bytes in 3 blocks
==10032==      possibly lost: 160 bytes in 2 blocks
==10032==    still reachable: 459,277 bytes in 4,306 blocks
==10032==         suppressed: 0 bytes in 0 blocks
==10032== Rerun with --leak-check=full to see details of leaked memory
==10032== 
==10032== For counts of detected and suppressed errors, rerun with: -v
==10032== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==10034== Warning: invalid file descriptor 1024 in syscall close()
==10034== Warning: invalid file descriptor 1025 in syscall close()
==10034== Warning: invalid file descriptor 1026 in syscall close()
==10034== Warning: invalid file descriptor 1027 in syscall close()
==10034==    Use --log-fd=<number> to select an alternative log fd.
==10034== Warning: invalid file descriptor 1028 in syscall close()
==10034== Warning: invalid file descriptor 1029 in syscall close()
==10034== 
==10034== HEAP SUMMARY:
==10034==     in use at exit: 851,380 bytes in 8,424 blocks
==10034==   total heap usage: 16,919 allocs, 8,495 frees, 3,946,535 bytes 
allocated
==10034== 
==10034== LEAK SUMMARY:
==10034==    definitely lost: 2,616 bytes in 6 blocks
==10034==    indirectly lost: 88 bytes in 3 blocks
==10034==      possibly lost: 528 bytes in 3 blocks
==10034==    still reachable: 848,148 bytes in 8,412 blocks
==10034==         suppressed: 0 bytes in 0 blocks
==10034== Rerun with --leak-check=full to see details of leaked memory
==10034== 
==10034== For counts of detected and suppressed errors, rerun with: -v
==10034== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
[OK]
Loading extension: 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so...
==10035== 
==10035== HEAP SUMMARY:
==10035==     in use at exit: 1,021,005 bytes in 9,902 blocks
==10035==   total heap usage: 23,822 allocs, 13,920 frees, 4,463,793 bytes 
allocated
==10035== 
==10035== LEAK SUMMARY:
==10035==    definitely lost: 5,872 bytes in 12 blocks
==10035==    indirectly lost: 139 bytes in 6 blocks
==10035==      possibly lost: 160 bytes in 2 blocks
==10035==    still reachable: 1,014,834 bytes in 9,882 blocks
==10035==         suppressed: 0 bytes in 0 blocks
==10035== Rerun with --leak-check=full to see details of leaked memory
==10035== 
==10035== For counts of detected and suppressed errors, rerun with: -v
==10035== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
    Loaded extension: PML Component (<b>New PML COMPONENT!</b>). Managed 
extension:pml
[OK]
Opening component: truthcube.pml...
[OK]
Saving component to: truthcube.pml...
[OK]
Closing component: truthcube.pml...
==10030== Invalid read of size 8
==10030==    at 0x11CDE0D0: MultiComponent::deleteAllSubComponents() 
(MultiComponent.cpp:50)
==10030==    by 0x11CDE11E: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:41)
==10030==    by 0x11CDE148: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:45)
==10030==    by 0x11CDEE39: PhysicalModel::clear() (PhysicalModel.cpp:99)
==10030==    by 0x11CDEF16: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:68)
==10030==    by 0x11CDEF58: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:69)
==10030==    by 0x11CC9A3C: PMLComponent::~PMLComponent() (PMLComponent.cpp:96)
==10030==    by 0x11CCA5A8: PMLComponent::~PMLComponent() (PMLComponent.cpp:98)
==10030==    by 0x48D9AD6: camitk::Application::close(camitk::Component*) 
(Application.cpp:623)
==10030==    by 0x10FC5B: main (main.cpp:204)
==10030==  Address 0x196eff70 is 0 bytes inside a block of size 80 free'd
==10030==    at 0x4836EEB: operator delete(void*) (vg_replace_malloc.c:576)
==10030==    by 0x11CDE0D5: MultiComponent::deleteAllSubComponents() 
(MultiComponent.cpp:50)
==10030==    by 0x11CDE11E: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:41)
==10030==    by 0x11CDE148: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:45)
==10030==    by 0x11CDEE39: PhysicalModel::clear() (PhysicalModel.cpp:99)
==10030==    by 0x11CDEF16: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:68)
==10030==    by 0x11CDEF58: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:69)
==10030==    by 0x11CC9A3C: PMLComponent::~PMLComponent() (PMLComponent.cpp:96)
==10030==    by 0x11CCA5A8: PMLComponent::~PMLComponent() (PMLComponent.cpp:98)
==10030==    by 0x48D9AD6: camitk::Application::close(camitk::Component*) 
(Application.cpp:623)
==10030==    by 0x10FC5B: main (main.cpp:204)
==10030==  Block was alloc'd at
==10030==    at 0x4835E2F: operator new(unsigned long) (vg_replace_malloc.c:334)
==10030==    by 0x11CE45D1: 
PhysicalModel::parseComponents(physicalModel::MultiComponent, Component*, bool) 
(PhysicalModel.cpp:510)
==10030==    by 0x11CE51FB: 
PhysicalModel::parseTree(std::unique_ptr<physicalModel::PhysicalModel, 
std::default_delete<physicalModel::PhysicalModel> >, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
>) (PhysicalModel.cpp:439)
==10030==    by 0x11CE56B3: PhysicalModel::xmlRead(char const*) 
(PhysicalModel.cpp:385)
==10030==    by 0x11CE59D1: PhysicalModel::PhysicalModel(char const*, void 
(*)(float)) (PhysicalModel.cpp:63)
==10030==    by 0x11CCA836: PMLComponent::PMLComponent(QString const&) 
(PMLComponent.cpp:78)
==10030==    by 0x11CD0AEF: PMLComponentExtension::open(QString const&) 
(PMLComponentExtension.cpp:67)
==10030==    by 0x48DAC23: camitk::Application::open(QString const&) 
(Application.cpp:470)
==10030==    by 0x10FA02: main (main.cpp:180)
==10030== 
==10030== Jump to the invalid address stated on the next line
==10030==    at 0x0: ???
==10030==    by 0x11CDE0D5: MultiComponent::deleteAllSubComponents() 
(MultiComponent.cpp:50)
==10030==    by 0x11CDE11E: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:41)
==10030==    by 0x11CDE148: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:45)
==10030==    by 0x11CDEE39: PhysicalModel::clear() (PhysicalModel.cpp:99)
==10030==    by 0x11CDEF16: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:68)
==10030==    by 0x11CDEF58: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:69)
==10030==    by 0x11CC9A3C: PMLComponent::~PMLComponent() (PMLComponent.cpp:96)
==10030==    by 0x11CCA5A8: PMLComponent::~PMLComponent() (PMLComponent.cpp:98)
==10030==    by 0x48D9AD6: camitk::Application::close(camitk::Component*) 
(Application.cpp:623)
==10030==    by 0x10FC5B: main (main.cpp:204)
==10030==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==10030== 
==10030== 
==10030== Process terminating with default action of signal 11 (SIGSEGV)
==10030==  Bad permissions for mapped region at address 0x0
==10030==    at 0x0: ???
==10030==    by 0x11CDE0D5: MultiComponent::deleteAllSubComponents() 
(MultiComponent.cpp:50)
==10030==    by 0x11CDE11E: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:41)
==10030==    by 0x11CDE148: MultiComponent::~MultiComponent() 
(MultiComponent.cpp:45)
==10030==    by 0x11CDEE39: PhysicalModel::clear() (PhysicalModel.cpp:99)
==10030==    by 0x11CDEF16: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:68)
==10030==    by 0x11CDEF58: PhysicalModel::~PhysicalModel() 
(PhysicalModel.cpp:69)
==10030==    by 0x11CC9A3C: PMLComponent::~PMLComponent() (PMLComponent.cpp:96)
==10030==    by 0x11CCA5A8: PMLComponent::~PMLComponent() (PMLComponent.cpp:98)
==10030==    by 0x48D9AD6: camitk::Application::close(camitk::Component*) 
(Application.cpp:623)
==10030==    by 0x10FC5B: main (main.cpp:204)
==10030== 
==10030== HEAP SUMMARY:
==10030==     in use at exit: 8,523,333 bytes in 54,797 blocks
==10030==   total heap usage: 714,992 allocs, 660,195 frees, 204,054,986 bytes 
allocated
==10030== 
==10030== LEAK SUMMARY:
==10030==    definitely lost: 181,736 bytes in 1,507 blocks
==10030==    indirectly lost: 1,601,472 bytes in 18,778 blocks
==10030==      possibly lost: 38,017 bytes in 488 blocks
==10030==    still reachable: 6,702,108 bytes in 34,024 blocks
==10030==         suppressed: 0 bytes in 0 blocks
==10030== Rerun with --leak-check=full to see details of leaked memory
==10030== 
==10030== For counts of detected and suppressed errors, rerun with: -v
==10030== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 2 from 2)
Speicherzugriffsfehler (Speicherabzug geschrieben)






gdb -q --args 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2

directory /home/benutzer/camitk/try1/camitk-4.1.2
set height 0
set width 0
set pagination off
b MultiComponent.cpp:50
y
run
display component
display components
cont



Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d9e900) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
(gdb) display component
1: component = (Component *&) @0x555558287ff0: 0x555557c5ee60
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d9e900) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x555558287ff8: 0x555557c5ffe0
(gdb) 
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d98b90) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x555558296a50: 0x5555579d7950
(gdb) 
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x5555579d7950) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x55555855c5e0: 0x5555585561e0
(gdb) 
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d98b90) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x555558296a58: 0x555557c57660
(gdb) 
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d98b90) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x555558296a60: 0x555557c57660
(gdb) 
Continuing.

Thread 1 "camitk-testcomp" received signal SIGSEGV, Segmentation fault.
0x0000000000000061 in ?? ()



-> 0x555557c57660 is deleted twice ?









gdb -q --args 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2
Reading symbols from 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents...done.
(gdb) directory /home/benutzer/camitk/try1/camitk-4.1.2
Source directories searched: /home/benutzer/camitk/try1/camitk-4.1.2:$cdir:$cwd
(gdb) set height 0
(gdb) set width 0
(gdb) set pagination off
(gdb) b MultiComponent.cpp:50
No source file named MultiComponent.cpp.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (MultiComponent.cpp:50) pending.
(gdb) run
Starting program: 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
camitk-testcomponents run with arguments:
- component library file: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so"
- input test file: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml"
- level of test: "2"
- output directory: 
"/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2"
Starting the camitk default application...
[New Thread 0x7fffec502700 (LWP 10849)]
[New Thread 0x7fffebbc5700 (LWP 10851)]
[OK]
Loading extension: 
/home/benutzer/camitk/try1/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so...
    Loaded extension: PML Component (<b>New PML COMPONENT!</b>). Managed 
extension:pml
[OK]
Opening component: truthcube.pml...
[New Thread 0x7fffe2854700 (LWP 10854)]
[New Thread 0x7fffe2053700 (LWP 10855)]
[New Thread 0x7fffe1852700 (LWP 10856)]
[New Thread 0x7fffe1051700 (LWP 10857)]
[New Thread 0x7fffe0850700 (LWP 10858)]
[New Thread 0x7fffcbfff700 (LWP 10859)]
[New Thread 0x7fffcb7fe700 (LWP 10860)]
[New Thread 0x7fffcaffd700 (LWP 10861)]
[OK]
Saving component to: truthcube.pml...
[OK]
Closing component: truthcube.pml...

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d9e0a0) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
(gdb) display component
1: component = (Component *&) @0x555558287790: 0x555557c5e600
(gdb) display components
2: components = std::vector of length 2, capacity 2 = {0x555557c5e600, 
0x555557c5f780}
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d9e0a0) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x555558287798: 0x555557c5f780
2: components = std::vector of length 1, capacity 2 = {0x555557c5f780}
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x5555582961f0: 0x5555579d70f0
2: components = std::vector of length 3, capacity 4 = {0x5555579d70f0, 
0x555558698970, 0x555557c56e00}
(gdb) print components->_M_impl._M_finish
$1 = (std::_Vector_base<Component*, std::allocator<Component*> >::pointer) 
0x555558296208
(gdb) print components->_M_impl._M_finish - components->_M_impl._M_start
$2 = 3
(gdb) print &(components->_M_impl._M_finish)
$3 = (std::_Vector_base<Component*, std::allocator<Component*> >::pointer *) 
0x555556d98368
(gdb) print &(components->_M_impl._M_start) 
$4 = (std::_Vector_base<Component*, std::allocator<Component*> >::pointer *) 
0x555556d98360
(gdb) watch *0x555556d98368
Hardware watchpoint 2: *0x555556d98368
(gdb) watch *0x555556d98360
Hardware watchpoint 3: *0x555556d98360
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x5555579d70f0) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x55555855bd80: 0x555558555980
2: components = std::vector of length 1, capacity 1 = {0x555558555980}
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Hardware watchpoint 2: *0x555556d98368

Old value = 1479107080
New value = 1479107072
MultiComponent::removeSubComponent (c=0x5555579d70f0, this=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.h:134
134             c->removeParentMultiComponent(this);
2: components = std::vector of length 2, capacity 4 = {0x555558698970, 
0x555557c56e00}
(gdb) bt
#0  MultiComponent::removeSubComponent (c=0x5555579d70f0, this=0x555556d98330) 
at ./modeling/libraries/pml/MultiComponent.h:134
#1  Component::removeFromParents() () at 
./modeling/libraries/pml/Component.cpp:60
#2  0x00007fffeb32c127 in MultiComponent::~MultiComponent (this=0x5555579d70f0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:44
#3  0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x5555579d70f0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#4  0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
#5  0x00007fffeb32c11f in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:41
#6  0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#7  0x00007fffeb32ce3a in PhysicalModel::clear (this=this@entry=0x555555705ef0) 
at ./modeling/libraries/pml/PhysicalModel.cpp:99
#8  0x00007fffeb32cf17 in PhysicalModel::~PhysicalModel (this=0x555555705ef0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:68
#9  0x00007fffeb32cf59 in PhysicalModel::~PhysicalModel (this=0x555555705ef0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:67
#10 0x00007fffeb317a3d in PMLComponent::~PMLComponent (this=0x555555660a00, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:96
#11 0x00007fffeb3185a9 in PMLComponent::~PMLComponent (this=0x555555660a00, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:93
#12 0x00007ffff7ec4ad7 in camitk::Application::close(camitk::Component*) () at 
./sdk/libraries/core/application/Application.cpp:623
#13 0x000055555555bc5c in main () at 
./sdk/applications/testcomponents/main.cpp:204
#14 0x00007ffff6e99b17 in __libc_start_main (main=0x55555555b080 <main>, 
argc=9, argv=0x7fffffffe398, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffe388) at ../csu/libc-start.c:310
#15 0x000055555555c35a in _start () at 
./sdk/applications/testcomponents/main.cpp:136
(gdb) finish
Run till exit from #0  MultiComponent::removeSubComponent (c=0x5555579d70f0, 
this=0x555556d98330) at ./modeling/libraries/pml/MultiComponent.h:134
Component::removeFromParents() () at ./modeling/libraries/pml/Component.cpp:51
51          std::vector <MultiComponent*> parentMultiComponentsCopy;
2: components = <error: There is no member or method named components.>
(gdb) 
Run till exit from #0  Component::removeFromParents() () at 
./modeling/libraries/pml/Component.cpp:51
MultiComponent::~MultiComponent (this=0x5555579d70f0, __in_chrg=<optimized 
out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
38      MultiComponent::~MultiComponent() {
2: components = std::vector of length 0, capacity 1
(gdb) 
Run till exit from #0  MultiComponent::~MultiComponent (this=0x5555579d70f0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x5555579d70f0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
38      MultiComponent::~MultiComponent() {
2: components = std::vector of length 0, capacity 1
(gdb) 
Run till exit from #0  0x00007fffeb32c149 in MultiComponent::~MultiComponent 
(this=0x5555579d70f0, __in_chrg=<optimized out>) at 
./modeling/libraries/pml/MultiComponent.cpp:38
0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x5555582961f0: 0x555558698970
2: components = std::vector of length 2, capacity 4 = {0x555558698970, 
0x555557c56e00}
(gdb) print components->_M_impl._M_finish - components->_M_impl._M_start
$5 = 2
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x5555582961f8: 0x555557c56e00
2: components = std::vector of length 2, capacity 4 = {0x555558698970, 
0x555557c56e00}
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Hardware watchpoint 2: *0x555556d98368

Old value = 1479107072
New value = 1479107064
MultiComponent::removeSubComponent (c=0x555557c56e00, this=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.h:134
134             c->removeParentMultiComponent(this);
2: components = std::vector of length 1, capacity 4 = {0x555558698970}
(gdb) finish
Run till exit from #0  MultiComponent::removeSubComponent (c=0x555557c56e00, 
this=0x555556d98330) at ./modeling/libraries/pml/MultiComponent.h:134
Component::removeFromParents() () at ./modeling/libraries/pml/Component.cpp:51
51          std::vector <MultiComponent*> parentMultiComponentsCopy;
2: components = <error: There is no member or method named components.>
(gdb) 
Run till exit from #0  Component::removeFromParents() () at 
./modeling/libraries/pml/Component.cpp:51
StructuralComponent::~StructuralComponent (this=0x555557c56e00, 
__in_chrg=<optimized out>) at 
./modeling/libraries/pml/StructuralComponent.cpp:73
73      StructuralComponent::~StructuralComponent() {
2: components = <error: There is no member or method named components.>
(gdb) 
Run till exit from #0  StructuralComponent::~StructuralComponent 
(this=0x555557c56e00, __in_chrg=<optimized out>) at 
./modeling/libraries/pml/StructuralComponent.cpp:73
0x00007fffeb3340a9 in StructuralComponent::~StructuralComponent 
(this=0x555557c56e00, __in_chrg=<optimized out>) at 
./modeling/libraries/pml/StructuralComponent.cpp:73
73      StructuralComponent::~StructuralComponent() {
2: components = <error: There is no member or method named components.>
(gdb) 
Run till exit from #0  0x00007fffeb3340a9 in 
StructuralComponent::~StructuralComponent (this=0x555557c56e00, 
__in_chrg=<optimized out>) at 
./modeling/libraries/pml/StructuralComponent.cpp:73
0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x5555582961f8: 0x555557c56e00
2: components = std::vector of length 1, capacity 4 = {0x555558698970}
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" hit Breakpoint 1, 
MultiComponent::deleteAllSubComponents (this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
1: component = (Component *&) @0x555558296200: 0x555557c56e00
2: components = std::vector of length 1, capacity 4 = {0x555558698970}
(gdb) cont
Continuing.

Thread 1 "camitk-testcomp" received signal SIGSEGV, Segmentation fault.
0x0000000000000061 in ?? ()
2: components = <error: current stack frame does not contain a variable named 
`this'>
(gdb) bt
#0  0x0000000000000061 in ?? ()
#1  0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
#2  0x00007fffeb32c11f in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:41
#3  0x00007fffeb32c149 in MultiComponent::~MultiComponent (this=0x555556d98330, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/MultiComponent.cpp:38
#4  0x00007fffeb32ce3a in PhysicalModel::clear (this=this@entry=0x555555705ef0) 
at ./modeling/libraries/pml/PhysicalModel.cpp:99
#5  0x00007fffeb32cf17 in PhysicalModel::~PhysicalModel (this=0x555555705ef0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:68
#6  0x00007fffeb32cf59 in PhysicalModel::~PhysicalModel (this=0x555555705ef0, 
__in_chrg=<optimized out>) at ./modeling/libraries/pml/PhysicalModel.cpp:67
#7  0x00007fffeb317a3d in PMLComponent::~PMLComponent (this=0x555555660a00, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:96
#8  0x00007fffeb3185a9 in PMLComponent::~PMLComponent (this=0x555555660a00, 
__in_chrg=<optimized out>) at 
./modeling/components/pmlcomponent/PMLComponent.cpp:93
#9  0x00007ffff7ec4ad7 in camitk::Application::close(camitk::Component*) () at 
./sdk/libraries/core/application/Application.cpp:623
#10 0x000055555555bc5c in main () at 
./sdk/applications/testcomponents/main.cpp:204
#11 0x00007ffff6e99b17 in __libc_start_main (main=0x55555555b080 <main>, 
argc=9, argv=0x7fffffffe398, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffe388) at ../csu/libc-start.c:310
#12 0x000055555555c35a in _start () at 
./sdk/applications/testcomponents/main.cpp:136
(gdb) up
#1  0x00007fffeb32c0d6 in MultiComponent::deleteAllSubComponents 
(this=this@entry=0x555556d98330) at 
./modeling/libraries/pml/MultiComponent.cpp:50
50              delete component;
(gdb) list -
45      }
46
47      // ------------------ deleteAllSubComponents ---------------------
48      void MultiComponent::deleteAllSubComponents() {
49          for (auto& component : components) {
50              delete component;
51          }
52          components.clear();
53      }
54
(gdb)







(gdb) list modeling/libraries/pml/MultiComponent.h:134
129     }
130     inline void MultiComponent::removeSubComponent(Component* c) {
131         auto it = std::find(components.begin(), components.end(), c);
132         if (it != components.end()) {
133             components.erase(it);
134             c->removeParentMultiComponent(this);
135         }
136     }









benutzer@debian:~/camitk/try2/camitk-4.1.2$ git init
Leeres Git-Repository in /home/benutzer/camitk/try2/camitk-4.1.2/.git/ 
initialisiert
benutzer@debian:~/camitk/try2/camitk-4.1.2$ git add .
benutzer@debian:~/camitk/try2/camitk-4.1.2$ git config user.name "Bernhard 
Übelacker"
benutzer@debian:~/camitk/try2/camitk-4.1.2$ git config user.email 
"bernha...@mailbox.org"
benutzer@debian:~/camitk/try2/camitk-4.1.2$ git commit -m "Initial commit"

mc -e modeling/libraries/pml/MultiComponent.cpp



Xvfb
export DISPLAY=:0
export LD_LIBRARY_PATH=/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/lib

valgrind 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2


gdb -q --args 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/bin/camitk-testcomponents 
-i 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/share/camitk-4.1/testdata/truthcube.pml
 -c 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/lib/camitk-4.1/components/libpmlcomponent.so
 -l 2 -o 
/home/benutzer/camitk/try2/camitk-4.1.2/camitk-build/Testing/Temporary/component-pmlcomponent-level3-2

directory /home/benutzer/camitk/try2/camitk-4.1.2
set height 0
set width 0
set pagination off
b MultiComponent.cpp:50
y
run
display component
display components
cont






https://en.cppreference.com/w/cpp/language/range-for
https://en.cppreference.com/w/cpp/container/vector/erase
    "Invalidates iterators and references at or after the point of the erase, 
including the end() iterator. "

https://stackoverflow.com/questions/10360461/removing-item-from-vector-while-in-c11-range-for-loop

Reply via email to