From: Akira Kyle <ak@akirakyle.com>
To: emacs-devel@gnu.org
Subject: non-local exits in redisplay
Date: Sun, 11 Oct 2020 15:28:26 -0600 [thread overview]
Message-ID: <86h7r0v4ed.fsf@akirakyle.com> (raw)
Hi all,
I've been playing around with the xwidget code and I had a
question regarding non-local exits from inside redisplay. I've
found that if one places code somewhere in redisplay that ends up
signaling a lisp error through xsignal, it can often cause an
infinite redisplay loop. This seems to be due to xsignal causing a
nonlocal exit and the next redisplay will be begin, but unless
there's something different, the same code that caused the initial
xsignal will execute again and hence the infinte loop. Since I do
see code that calls lisp functions inside redisplay I was
wondering how one should guard against such non-local exits inside
redisplay.
As a concrete example, placing a call like
CALLN (Ffuncall, Qnil);
at the start of xwidget_init_view in xwidget.c will cause
redisplay to infinite loop.
Note: if you actually try this you'll get a segfault which I think
is due to xwidget-webkit-callback executing asynchronously which
tries access state that doesn't exist yet because redisplay is
infinite looping. To actually see the infinite loop just return
Qnil from Fxwidget_webkit_title.
Is there a safe way to handle such cases apart from avoiding
calling into lisp functions which may non-local exit or manually
checking that the arguments you pass will not cause a non-local
exit?
I'm very new to hacking on Emacs' C source code so it's also
entirely possible I missed some bigger concept that makes this
actually a silly question :)
Akira
next reply other threads:[~2020-10-11 21:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-11 21:28 Akira Kyle [this message]
2020-10-11 22:31 ` non-local exits in redisplay Stefan Monnier
2020-10-12 0:27 ` Akira Kyle
2020-10-12 3:44 ` Stefan Monnier
2020-10-12 17:01 ` Eli Zaretskii
2020-10-12 19:19 ` Akira Kyle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86h7r0v4ed.fsf@akirakyle.com \
--to=ak@akirakyle.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).