GNOME Bugzilla – Bug 618195
Skip user_data arguments in gjs_callback_closure
Last modified: 2010-05-13 14:13:17 UTC
The user_data argument to a callback now holds the GjsCallbackTrampoline instead of a JS provided value, so we must not cast it to a jsval and treat it as a function argument. This fixes segfaults when trying to get a stracktrace inside a callback.
Created attachment 160663 [details] [review] Skip user_data arguments in gjs_callback_closure
Review of attachment 160663 [details] [review]: Oops, good catch.
Created attachment 160728 [details] [review] Skip user_data arguments in gjs_callback_closure New version that passes the right argc to JS_CallFunctionValue
Review of attachment 160728 [details] [review]: Looks good. Should update tests to verify that arguments.length for callbacks is correctly set. ::: gi/function.c @@ -159,3 @@ g_assert(n_args >= 0); jsargs = (jsval*)g_newa(jsval, n_args); You're allocating space for the void arguments here as well, afacs.
Created attachment 160729 [details] [review] Skip user_data arguments in gjs_callback_closure This adds a test (not *quite* sure I understand the point of the three argument form of assertEquals()). The over-allocation of jsargs is intentional - it's not worth two passes to avoid allocating a single jsval on the stack.
Review of attachment 160729 [details] [review]: Looks great, thanks.
Attachment 160729 [details] pushed as 269e4fd - Skip user_data arguments in gjs_callback_closure