emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

non-local exits in redisplay


From: Akira Kyle
Subject: non-local exits in redisplay
Date: Sun, 11 Oct 2020 15:28:26 -0600
User-agent: mu4e 1.4.13; emacs 28.0.50

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]