aboutsummaryrefslogtreecommitdiffstats
path: root/src/xwidget.c
diff options
context:
space:
mode:
authorPaul Eggert2017-02-20 08:53:50 -0800
committerPaul Eggert2017-02-20 08:58:50 -0800
commita6e76fc7254ddac7729224a891feb8ed3f183efc (patch)
tree70ae183559359c5589714231429c5f58bdc5caa6 /src/xwidget.c
parent589bd0c22b2d55c3d0339221f67235b33be93f68 (diff)
downloademacs-a6e76fc7254ddac7729224a891feb8ed3f183efc.tar.gz
emacs-a6e76fc7254ddac7729224a891feb8ed3f183efc.zip
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.c17
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,
389 /* Register an xwidget event here, which then runs the callback. 389 /* Register an xwidget event here, which then runs the callback.
390 This ensures that the callback runs in sync with the Emacs 390 This ensures that the callback runs in sync with the Emacs
391 event loop. */ 391 event loop. */
392 store_xwidget_js_callback_event (xw, (Lisp_Object)lisp_callback, 392 /* FIXME: This might lead to disaster if LISP_CALLBACK’s object
393 was garbage collected before now. See the FIXME in
394 Fxwidget_webkit_execute_script. */
395 store_xwidget_js_callback_event (xw, XIL ((intptr_t) lisp_callback),
393 lisp_value); 396 lisp_value);
394} 397}
395 398
@@ -714,8 +717,13 @@ argument procedure FUN.*/)
714 if (!NILP (fun) && !FUNCTIONP (fun)) 717 if (!NILP (fun) && !FUNCTIONP (fun))
715 wrong_type_argument (Qinvalid_function, fun); 718 wrong_type_argument (Qinvalid_function, fun);
716 719
717 void *callback = (FUNCTIONP (fun)) ? 720 GAsyncReadyCallback callback
718 &webkit_javascript_finished_cb : NULL; 721 = FUNCTIONP (fun) ? webkit_javascript_finished_cb : NULL;
722
723 /* FIXME: This hack might lead to disaster if FUN is garbage
724 collected before store_xwidget_js_callback_event makes it visible
725 to Lisp again. See the FIXME in webkit_javascript_finished_cb. */
726 gpointer callback_arg = (gpointer) (intptr_t) XLI (fun);
719 727
720 /* JavaScript execution happens asynchronously. If an elisp 728 /* JavaScript execution happens asynchronously. If an elisp
721 callback function is provided we pass it to the C callback 729 callback function is provided we pass it to the C callback
@@ -723,8 +731,7 @@ argument procedure FUN.*/)
723 webkit_web_view_run_javascript (WEBKIT_WEB_VIEW (xw->widget_osr), 731 webkit_web_view_run_javascript (WEBKIT_WEB_VIEW (xw->widget_osr),
724 SSDATA (script), 732 SSDATA (script),
725 NULL, /* cancelable */ 733 NULL, /* cancelable */
726 callback, 734 callback, callback_arg);
727 (gpointer) fun);
728 return Qnil; 735 return Qnil;
729} 736}
730 737