DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D
http://www.reactphysics3d.com
zlib License
1.54k stars 224 forks source link

mBaseAllocator.release pure virtual method called causing SIGABRT #354

Open ZeunO8 opened 1 year ago

ZeunO8 commented 1 year ago
pure virtual method called
terminate called without an active exception

Thread 1 "Cojarexp" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
44  ./nptl/pthread_kill.c: No such file or directory.
(gdb) up
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
78  in ./nptl/pthread_kill.c
(gdb) 
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
89  in ./nptl/pthread_kill.c
(gdb) 
#3  0x00007ffff663c406 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
26  ../sysdeps/posix/raise.c: No such file or directory.
(gdb) 
#4  0x00007ffff662287c in __GI_abort () at ./stdlib/abort.c:79
79  ./stdlib/abort.c: No such file or directory.
(gdb) 
#5  0x00007ffff6aa4f06 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) 
#6  0x00007ffff6ab6eac in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) 
#7  0x00007ffff6ab6f17 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) 
#8  0x00007ffff6ab7c45 in __cxa_pure_virtual () from /lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) 
#9  0x00007ffff6ff9f7c in reactphysics3d::HeapAllocator::~HeapAllocator (this=0x7ffff01e8590, __in_chrg=<optimized out>)
    at /home/saeun/Projects/coje/venjor/reactphysics3d/src/memory/HeapAllocator.cpp:69
69          mBaseAllocator.release(static_cast<void*>(unit), unitSize + sizeof(MemoryUnitHeader));
(gdb) print mBaseAllocator
$4 = (reactphysics3d::MemoryAllocator &) @0x555555813378: {_vptr.MemoryAllocator = 0x5555555cd8c0 <vtable for reactphysics3d::MemoryAllocator+16>}
(gdb)  up
#10 0x00007ffff6f04585 in reactphysics3d::MemoryManager::~MemoryManager (this=0x7ffff01e8580, __in_chrg=<optimized out>)
    at /home/saeun/Projects/coje/venjor/reactphysics3d/include/reactphysics3d/memory/MemoryManager.h:83
83         ~MemoryManager() = default;
(gdb) 
#11 0x00007ffff6eff915 in reactphysics3d::PhysicsCommon::~PhysicsCommon (this=0x7ffff01e8580, __in_chrg=<optimized out>)
    at /home/saeun/Projects/coje/venjor/reactphysics3d/src/engine/PhysicsCommon.cpp:57
57  }
(gdb) 
#12 0x00007ffff77b135f in operator() (__closure=0x7ffff01e8e48, physicsCommon=0x7ffff01e8580) at /home/saeun/Projects/coje/src/Scene.cpp:196
196    delete physicsCommon;

Could you please look into this?

DanielChappuis commented 1 year ago

Thanks for reporting this issue. Can you please tell me in which version/branch of the library this happens?

ZeunO8 commented 1 year ago

On the latest develop branch

ZeunO8 commented 5 months ago

I will implement an abstract physics driver in my engine for swapping out physics engines, then give rp3d a go with the latest version

DanielChappuis commented 5 months ago

Ok perfect. I have recently fixed an issue with this commit in the develop branch that might be the cause of this crash. I will release it soon in version 0.10.1.

I am really interested in your feedback.