SDL_KEYDOWN delivered to two processes

I have two processes, one of which was spawned by the other, both running SDL2 programs. The spawned process has ‘press any key to quit’ functionality, triggered by receiving either an SDL_KEYDOWN or SDL_TEXTINPUT event.

So far so good. If I press space, say, in the spawned process it terminates and the original process regains keyboard focus. But if I press Enter in the spawned process it quits and the original process receives a SDL_KEYDOWN event for the Enter key!

In other words, pressing the Enter key just once is causing both processes to receive an SDL_KEYDOWN event! The spawned process receives one, quits, and then the original process receives another one. :astonished:

This happens only in Linux; in Windows and MacOS everything works as expected. Is this a bug in SDL2? Is there some workaround I can use to stop the original process receiving the spurious SDL_KEYDOWN event?