Skip to content

Free JS Class Proto carefully #845

Answered by bnoordhuis
harumazzz asked this question in Q&A
Discussion options

You must be logged in to vote

When you call JS_SetClassProto, quickjs takes ownership of the object and ensures it's freed when the JSContext is destroyed. In other words, you should normally no longer touch it, but if you do, call JS_DupValue before JS_SetClassProto.

JS_SetConstructor does not take ownership, so business as usual.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@harumazzz
Comment options

Answer selected by harumazzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants