diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-02-20 08:53:50 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-02-20 08:58:50 -0800 |
commit | a6e76fc7254ddac7729224a891feb8ed3f183efc (patch) | |
tree | 70ae183559359c5589714231429c5f58bdc5caa6 /src/xwidget.c | |
parent | 589bd0c22b2d55c3d0339221f67235b33be93f68 (diff) | |
download | emacs-a6e76fc7254ddac7729224a891feb8ed3f183efc.tar.gz |
Port xwidget to -DCHECK_LISP_OBJECT_TYPE
* src/xwidget.c (webkit_javascript_finished_cb)
(Fxwidget_webkit_execute_script): Don't assume Lisp_Object is an
integer. This fix is just a hack; I’ll file a bug report about
the underlying problem.
Diffstat (limited to 'src/xwidget.c')
-rw-r--r-- | src/xwidget.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/xwidget.c b/src/xwidget.c index 5c276b1371c..dc705bb1404 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -389,7 +389,10 @@ webkit_javascript_finished_cb (GObject *webview, /* Register an xwidget event here, which then runs the callback. This ensures that the callback runs in sync with the Emacs event loop. */ - store_xwidget_js_callback_event (xw, (Lisp_Object)lisp_callback, + /* FIXME: This might lead to disaster if LISP_CALLBACK’s object + was garbage collected before now. See the FIXME in + Fxwidget_webkit_execute_script. */ + store_xwidget_js_callback_event (xw, XIL ((intptr_t) lisp_callback), lisp_value); } @@ -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); /* JavaScript execution happens asynchronously. If an elisp callback function is provided we pass it to the C callback @@ -723,8 +731,7 @@ argument procedure FUN.*/) webkit_web_view_run_javascript (WEBKIT_WEB_VIEW (xw->widget_osr), SSDATA (script), NULL, /* cancelable */ - callback, - (gpointer) fun); + callback, callback_arg); return Qnil; } |