From: Po Lu Date: Sat, 6 Nov 2021 06:01:56 +0000 (+0800) Subject: Make it safe to have non-xwidget views in xwidget-view-list X-Git-Tag: emacs-29.0.90~3671^2~128 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cb45114363b91964eeded4bdd18fbb85fbbb225f;p=emacs.git 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. --- 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 ();