Killing Xwayland makes Mutter exit with code 0
Affected version
Manjaro (GNOME 3.36); Pop! OS 20.04 (GNOME 3.36); Fedora Rawhide (GNOME 3.37); Fedora Rawhide (Mutter built from the repo master branch);
Issue appears only on Wayland
Bug summary
Steps to reproduce
1(1). Enable autostart-xwayland
experimental feature, so Xwayland won't be required for functioning;
2. Run an X11 app, e.g. xev on Mutter's Xwayland display.
3. Kill Xwayland using command or system monitor
(1) issue is also present without that flag, but Mutter should exit when Xwayland is mandatory.
What happened
Mutter printed a warning Connection to xwayland lost
and exited with code 0.
What did you expect to happen
Mutter continues operating, printing a log line saying that Xwayland will be started when required again.
Relevant logs, screenshots, screencasts etc.
When trying to debug this myself, I found that message is printed by x_io_error (/src/wayland/meta-xwayland.c) function and then XLib exits Mutter because of fatal X11 IO error (lost connection to server). Sorry, I couldn't come up with a solution that would be XLib compliant.