GNOME Bugzilla – Bug 785040
Misc 1.49 and mozjs52 enhancements
Last modified: 2017-07-18 15:36:24 UTC
A few minor fixes found while testing existing code with the new branch: - Better debug info for the "Attempting to call back into JSAPI during GC" message - Use correct autoptr in gjs_string_to_filename(), which cascades into a bunch of other places - Adjust ALWAYS_INLINE macro to avoid warnings on GCC 4.9
Created attachment 355780 [details] [review] build: Use 'always inline' macro in more places On GCC 4.9, the inliner heuristic starts to complain again, because SpiderMonkey 52 includes more 'always inline' functions, so when we add ours in there, the inliner decides that functions are growing too much in size due to inlined code. Add a GJS_ALWAYS_INLINE macro just like Mozilla does in their code, and use it for our templated code and other boilerplate.
Created attachment 355781 [details] [review] js: Use correct autoptr in gjs_string_to_filename() The return value of g_filename_from_utf8() (must be freed with g_free()) was getting assigned to a GjsAutoJSChar (which would be freed with JS_free()). Instead gjs_string_to_filename() must have a GjsAutoChar output parameter. This requires changing gjs_parse_call_args() as well. We improve it by allowing to pass in autoptrs for 's' or 'F' args instead of char**. Fixes a few minor memory leaks, mostly in error paths in Cairo functions.
Created attachment 355782 [details] [review] function: Better message about call during GC GJS can attempt to call back into JS during garbage collection if you implement vfunc_remove() on your container class. (Destroying a container will remove all its child widgets, and if you have implemented vfunc_remove() in JS then that will cause a JS call.) Note this possibility in the warning message, and also add whatever information we can get about the offending callback without calling into JSAPI.
Review of attachment 355780 [details] [review]: OK
Review of attachment 355781 [details] [review]: Looks good ::: modules/cairo-pdf-surface.cpp @@ +58,2 @@ return false; + Remove empty line
Review of attachment 355782 [details] [review]: OK
Attachment 355780 [details] pushed as c1b352a - build: Use 'always inline' macro in more places Attachment 355781 [details] fixed and pushed as 9ddca8b - js: Use correct autoptr in gjs_string_to_filename() Attachment 355782 [details] pushed as 62a2b79 - function: Better message about call during GC