mike at vee.net
Sun Jan 1 16:47:23 PST 2017
As part of porting Geary to WK2 (I'm writing this from it now!) I have
been developing a Vala VAPI for JSC, so I can work with the JS
without dropping back to C. However since they are not GObjects and not
ref counted, I need to get the momeory management right still.
I've been trying to work out when to use functions like
JSGlobalContextRelease, JSStringRelease, and JSValueUnprotect, but
haven't been able to find any useful documentation about it. Also,
examples on the web seem to conflict: E.g. The WebKitGTK docs and
Cookbook uses JSStringRelease on a string copied from a JSValueRef,
whereas others (e.g. ) suggest that JSStringRelease only needs to be
used in certain instances, or that it needs to be used all the time.
Any pointers to canonical docs and examples would be appreciated.
I assume I never need to release a JSGlobalContextRef obtained from
retain it, but what about the others? Would it hurt to call
JSGlobalContextRelease and JSStringRelease even if not needed? What
Also, my assumption that JSC objects should be treated as Vala simple
types, i.e. they should be passed as copies (not by reference), that's
correct isn't it?
⊨ Michael Gratton, Percept Wrangler.
More information about the webkit-gtk