From cb45114363b91964eeded4bdd18fbb85fbbb225f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 6 Nov 2021 14:01:56 +0800 Subject: [PATCH] Make it safe to have non-xwidget views in xwidget-view-list * src/xwidget.c (define_cursors, offscreen_damage_event): Check XWIDGET_VIEW_P before XXWIDGET_VIEW. --- src/xwidget.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/xwidget.c b/src/xwidget.c index 9d1fe68ec3e..36e8cab08da 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -609,13 +609,16 @@ define_cursors (struct xwidget *xw, WebKitHitTestResult *res) for (Lisp_Object tem = Vxwidget_view_list; CONSP (tem); tem = XCDR (tem)) { - xvw = XXWIDGET_VIEW (XCAR (tem)); - - if (XXWIDGET (xvw->model) == xw) + if (XWIDGET_VIEW_P (XCAR (tem))) { - xvw->cursor = cursor_for_hit (xw->hit_result, xvw->frame); - if (xvw->wdesc != None) - XDefineCursor (xvw->dpy, xvw->wdesc, xvw->cursor); + xvw = XXWIDGET_VIEW (XCAR (tem)); + + if (XXWIDGET (xvw->model) == xw) + { + xvw->cursor = cursor_for_hit (xw->hit_result, xvw->frame); + if (xvw->wdesc != None) + XDefineCursor (xvw->dpy, xvw->wdesc, xvw->cursor); + } } } } @@ -849,10 +852,13 @@ offscreen_damage_event (GtkWidget *widget, GdkEvent *event, for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail)) { - struct xwidget_view *view = XXWIDGET_VIEW (XCAR (tail)); + if (XWIDGET_VIEW_P (XCAR (tail))) + { + struct xwidget_view *view = XXWIDGET_VIEW (XCAR (tail)); - if (view->wdesc && XXWIDGET (view->model) == xwidget) - xv_do_draw (view, XXWIDGET (view->model)); + if (view->wdesc && XXWIDGET (view->model) == xwidget) + xv_do_draw (view, XXWIDGET (view->model)); + } } unblock_input (); -- 2.39.5