[Top][All Lists]

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

Re: [PATCH] On the nasty "ghost key" problem on NS

From: Stefan Monnier
Subject: Re: [PATCH] On the nasty "ghost key" problem on NS
Date: Sat, 05 Nov 2022 11:47:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> I’m not super familiar with the signal mechanism, but here are some
> findings.  (Assume that `waiting_for_input` is correctly maintained.)  On
> certain occasions (which still remain unclear to me), the `Vthrow_on_input`
> path in `process_quit_flag` is taken.  The curious thing is that `safe_call`
> does not seem to catch that, and thus the control flow directly moves to
> somewhere above the Lisp call in `firstRectForCharacterRange`.  Is it
> intentional that `safe_call` does not catch throw_on_input?

The implementation of `safe_call` protects against uses of `signal` but
not `throw`.  Is this intentional?  Good question.  AFAIK we don't
currently have a mechanism to catch all throws like we have for signals,
so that might be the explanation.

FWIW, my initial implementation of `while-no-input` used `signal` rather
than `throw` and Richard insisted that it was wrong and should use
`throw` instead.  I couldn't see any reason to prefer one over the other
(except that it was easier to use `signal`, hence my original choice).

AFAICT this is the first time I encounter where it seems to make
a difference :-)
Maybe this is telling us that I was right all along and `while-no-input`
should use `signal` rather than `throw`?  :-)

Then again, `ns-in-echo-area` and other functions called by `safe_call`
could explicitly call `throw` for all kinds of reasons, and it's not
clear what we should do in those cases: should we disallow/catch them
all, or let them all through?  Something in-between?

I wonder why it matters here and not in other uses of `safe_call`?

> (Also a correction: I guessed it could be related to threading at first.
> No, it’s not.  It’s always the main thread.)

Thanks.  That's good to know.


reply via email to

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