GNU bug report logs -
#72104
[PATCH] xwidget: Fix xwidget-at misinterpreting non-xwidget text-properties
Previous Next
Reported by: George Huebner <george <at> feyor.sh>
Date: Sun, 14 Jul 2024 07:20:01 UTC
Severity: normal
Tags: patch
Merged with 72848
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 72104 <at> debbugs.gnu.org (full text, mbox):
George Huebner <george <at> feyor.sh> writes:
> xwidget-at assumes the text-property at `point-min` either doesn't exist or is
> an xwidget, and can improperly access fields. This patch just returns nil if the
> text-property isn't an xwidget.
>
> This is definitely an edge case; I use a package called org-modern where
> headlines are formatted with text-properties, which is how I found the bug:
> Debugger entered--Lisp error: (wrong-type-argument listp #("◉" 0 1 (face
> org-modern-symbol)))
> xwidget-at(1)
> xwidget-webkit-current-session()
Po Lu, any comments on this patch?
>>From 48a662563bc6e7c5bc63dc63da4e0c36909b6cc2 Mon Sep 17 00:00:00 2001
> From: George Huebner <george <at> feyor.sh>
> Date: Sun, 14 Jul 2024 01:46:07 -0500
> Subject: [PATCH] xwidget: Fix xwidget-at misinterpreting non-xwidget
> text-properties
>
> xwidget-open wrongly assumes the the text-property at min-position is an
> xwidget, if it exists; the fix is just returning nil if the
> text-property isn't an xwidget.
> ---
> lisp/xwidget.el | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/xwidget.el b/lisp/xwidget.el
> index bf5987d..c5a84db 100644
> --- a/lisp/xwidget.el
> +++ b/lisp/xwidget.el
> @@ -81,7 +81,7 @@ This returns the result of `make-xwidget'."
> (defun xwidget-at (pos)
> "Return xwidget at POS."
> (let* ((disp (get-text-property pos 'display))
> - (xw (car (cdr (cdr disp)))))
> + (xw (ignore-errors (car (cdr (cdr disp))))))
> (when (xwidget-live-p xw) xw)))
This bug report was last modified 84 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.