Subject: Re: bug#25816: Emacs xwidget GC issue with callback

From: Andreas Schwab <[email-masked]>
Date: Mon, 20 Feb 2017 19:01:51 +0100

On Feb 20 2017, Paul Eggert <[email-masked]> wrote:

> @@ -714,8 +717,13 @@ argument procedure FUN.*/)
>    if (!NILP (fun) && !FUNCTIONP (fun))
>      wrong_type_argument (Qinvalid_function, fun);
>  
> -  void *callback = (FUNCTIONP (fun)) ?
> -    &webkit_javascript_finished_cb : NULL;
> +  GAsyncReadyCallback callback
> +    = FUNCTIONP (fun) ? webkit_javascript_finished_cb : NULL;
> +
> +  /* FIXME: This hack might lead to disaster if FUN is garbage
> +     collected before store_xwidget_js_callback_event makes it visible
> +     to Lisp again.  See the FIXME in webkit_javascript_finished_cb.  */
> +  gpointer callback_arg = (gpointer) (intptr_t) XLI (fun);

When --with-wide-int, EMACS_INT may be wider than a pointer, and this
discards the type bits.

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."