Tags: leftibot/ChaiScript
Tags
Fix ChaiScript#655: Async issues with threads outliving the chaiscrip… …t engine (ChaiScript#656) * Fix ChaiScript#655: Join async threads before engine destruction to prevent heap-use-after-free Issues ChaiScript#632 and ChaiScript#636 (PRs ChaiScript#651 and ChaiScript#653) both stem from the same root cause: async threads spawned via async() can outlive the Dispatch_Engine, accessing shared state (global objects map, type maps) after it has been destroyed. The fix moves async() registration from the stdlib module into ChaiScript_Basic, where spawned threads are tracked via Dispatch_Engine. The engine's destructor now joins all outstanding async threads before destroying shared data structures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address review: follow rule of 5, explicitly default move operations Requested by @lefticus in PR ChaiScript#656 review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: leftibot <leftibot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix lifetime of objects in ranged for loops Currently this is going to incur a performance cost, but it's correct. It may need to be reevaluated. Closes ChaiScript#392
PreviousNext