Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
-
|
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We use
return_value_policy::reference()to return references to C++ member objects. We noticed that.delete()is still available on the JS wrapper, and we're unsure what it does.Reproduction
What we observed
inner.delete()marks the wrapper as deleted (isDeleted()→ true)What we expected from reading the source
We traced
.delete()→releaseClassHandle→runDestructor→rawDestructor(ptr)which isdelete ptr. Sinceptrpoints to a member (notnew'd), we expected this to be undefined behaviour. But it doesn't crash.Questions
rawDestructoractually run for reference-returned pointers, or is there a guard we're missing?deleteon a non-heap pointer crash in WASM?.delete()on reference wrappers? Or is this .delete() only affecting the wrapper and it is safe to call it in the sense that it won't corrupt the original data structure?Beta Was this translation helpful? Give feedback.
All reactions