all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72848: [PATCH RESEND] xwidget: Fix xwidget-at misinterpreting non-xwidget text-properties
@ 2024-08-28  1:03 George Huebner
  2024-08-29 12:13 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: George Huebner @ 2024-08-28  1:03 UTC (permalink / raw)
  To: 72848

[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]

Tags: patch

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()


In GNU Emacs 29.1 (build 1, aarch64-apple-darwin23.6.0, Carbon 
Version
170 AppKit 2487.7)
Windowing system distributor 'Apple Inc.', version 14.6.0
System Description:  macOS 14.6

Configured using:
 'configure
 --prefix=/nix/store/59qdq2kd14ix95z4g3k9s6l79zwa2s2b-emacs-mac-macport-29.1
 --disable-build-details --with-modules --without-gif 
 --without-jpeg
 --without-png --without-tiff --without-x --without-xpm
 '--enable-mac-app=$$out/Applications' --with-gnutls --with-mac
 --with-xml2 --without-ns --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --with-mailutils --without-small-ja-dic
 --with-tree-sitter --without-xinput2 --without-xwidgets 
 --without-dbus
 --without-selinux --with-xwidgets'

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-xwidget-Fix-xwidget-at-misinterpreting-non-xwidget-t.patch --]
[-- Type: text/patch, Size: 909 bytes --]

From 48a662563bc6e7c5bc63dc63da4e0c36909b6cc2 Mon Sep 17 00:00:00 2001
From: George Huebner <george@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)))
 
 
-- 
2.44.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#72848: [PATCH RESEND] xwidget: Fix xwidget-at misinterpreting non-xwidget text-properties
  2024-08-28  1:03 bug#72848: [PATCH RESEND] xwidget: Fix xwidget-at misinterpreting non-xwidget text-properties George Huebner
@ 2024-08-29 12:13 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-08-29 12:13 UTC (permalink / raw)
  To: George Huebner; +Cc: 72848-done

> From: George Huebner <george@feyor.sh>
> Date: Tue, 27 Aug 2024 20:03:44 -0500
> 
> 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()

Thanks, installed on the emacs-30 branch, and closing the bug.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-29 12:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28  1:03 bug#72848: [PATCH RESEND] xwidget: Fix xwidget-at misinterpreting non-xwidget text-properties George Huebner
2024-08-29 12:13 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.