ThePhD / sol2

Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
http://sol2.rtfd.io/
MIT License
4.06k stars 492 forks source link

Crash during destruction when using meta_function::new_index and coroutines #1594

Open Maddimax opened 3 months ago

Maddimax commented 3 months ago

I attached a reproduction example to the ticket: main.cpp.txt

The example crashes during the m_entries.clear(); in the ~MyDynamic() destructor.

The crash only occurs if the test() function is started as a coroutine.

I sadly don't know enough about lua to see if this is a problem with lua itself, or something in sol2. Any help/hints would be greatly appreciated.

Build and reproduced on macOS 14,

clang++ --version                                                                                                                                              e0bb8f0 ✭ ✱ ◼
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin