unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* non-local exits in redisplay
@ 2020-10-11 21:28 Akira Kyle
  2020-10-11 22:31 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Akira Kyle @ 2020-10-11 21:28 UTC (permalink / raw)
  To: emacs-devel

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



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

end of thread, other threads:[~2020-10-12 19:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-11 21:28 non-local exits in redisplay Akira Kyle
2020-10-11 22:31 ` 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

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