Conversation
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This fixes a double-free bug in Global<T> cloning by replacing a bitwise pointer copy with V8's proper v8::Global<T>(Isolate*, const Global&) copy constructor, and removes the Clone trait impl in favor of an inherent method that takes &mut Lock.
The fix is correct — the old implementation created two v8::Global handles that shared the same persistent handle slot, so dropping both would double-free. One observation:
- Low: No regression test — This was a serious memory safety bug (double-free). It would be good to add a test in
src/rust/jsg-test/that exercisesGlobal<T>::clone()and verifies both original and clone can be independently dropped and dereferenced. Not blocking, but worth tracking.
|
I'm Bonk, and I've done a quick review of your PR. This fixes a double-free bug in The fix is correct. The C++ side properly uses One low-severity observation posted: no regression test for the double-free fix. Not blocking. |
afe997f to
1d9be5a
Compare
1d9be5a to
3204893
Compare
Create a proper independent persistent handle via V8's copy constructor. The previous implementation would cause a double-free when both the original and clone were dropped.