When I turn off monitor (by power button), my gtk4 app gets closed with no output and return code 0. From what I've read, it might be some interaction between wayland and gtk4, but I've found no fix except restarting app via some daemon listening for new monitors.
How can I keep my app open? Most apps do not close, but they are not in gtk4, so no idea if it's a bug or my misuse.
When trying to open the app without any monitors I get
Gdk-Message: 10:32:23.553: Error 22 (Bad argument) dispatching to Wayland display.
EDIT
It seems that, when monitor disappears, destroy signal is called on the window, and since it's the only window application stops.
I can guess then that there is nothing to keep the ref-counted Window alive, and since I must create window after connect_activate of app, and in main thread, there is no way to store the reference anyway.
So it looks like it all was done on purpose and I'm supposed to recreate windows when new monitors appear, which is annoying but doable.
app.run()is displayed. So I'm pretty sure there is no crash, just normal exit ofgtk4::Application