Creating the first window from a delayed g_main_context_invoke_full with G_PRIORITY_HIGH from a thread doesn't work
Steps to reproduce
- Build and run the attached main.c (optionally with CMakeLists.txt)
- ???
- No profit :(
Current behavior
The window doesn't show up
Expected outcome
The window should show up
Version information
Program | Version |
---|---|
GTK | 4.6.6, 4.10.3 |
OS | Pop!_OS 22.04, Fedora 38 Workstation |
Session type | Wayland <-- this seems to matter, it doesn't reproduce on X11 |
Additional information
I'm trying to make an app that lies dormant until it receives data from a socket, then it opens a window.
To do that, I have a thread that calls g_main_context_invoke_full
when I want to open a window (to run on the main thread).
I wanted to have it happen ASAP, so I used G_PRIORITY_HIGH
, which causes any windows created during the callback to not spawn.
Interestingly, this doesn't happen if a window has already spawned (e.g. when running with GTK_DEBUG=interactive
).
Here's a core file and a backtrace (Ctrl\ after it happened) of this phenomenon (on Fedora 38 / GTK 4.10.3): repro_files.zip
I first debugged this over at the forum, which has Rust and Python reproductions of this too.