Race condition when closing popups
Created by: dkondor
This is a second incarnation of #2432 (closed) -- the compositor crash I reported there was fixed by #2454 but now I'm seeing the client get an error in the same conditions.
Steps to reproduce:
- Download the test program from here: https://github.com/dkondor/wlroots/blob/issue-2432/issue-2432/wlr-crasher.c
- Compile it (a meson.build is in the same directory -- it can be compiled with meson independently of wlroots, by running everything inside in this dir)
- Run the resulting wlrc program
- Click on the blue popup (if there is no blue popup, just exit and try again -- it is not shown in some cases)
Expected behavior: the child process is focused and the popup is closed by the compositor
Actual behavior: the parent process exits with the following error: xdg_surface@16: error 3: xdg_surface has never been configured
Alternative, real-world case
My original problem with cairo-dock (from this branch) as described in #2432 (closed) -- instead of the compositor crashing, now only cairo-dock crashes when clicking on the magnifier. This does not always happen, but can be observed fairly regularly.
Notes
Tested on Wayfire master + wlroots master. The strange thing is that I was testing this originally when #2454 was merged and could not see this problem. Now I've tried again, using wlroots 9595f954 + Wayfire a36b931 and I can see the problem in that case. So I'm confused if this is a regression or if I just missed this previously (although I'm quite certain it was working at that time).
Otherwise, this seems to be the same race condition as before. The error comes from here which tests that surface->configured
is false. This is set to false by unmap_xdg_surface()
here that is called from reset_xdg_surface()
(here), that is called from here after sending the popup_done
event to the client.