Closed jaen closed 11 months ago
Sorry, didn't have chance to test this earlier. With the patch it doesn't fail, it only logs the issue as expected:
[LOG] [screencopy] Stream destroyed
[LOG] [screencopy] Session destroyed
[ERR] [pw] Attempted enqueue on invalid session??
FWIW the restore tokens still don't work in nether Brave nor Firefox.
FWIW the restore tokens still don't work in nether Brave nor Firefox.
unrelated
f5c3576c3b6cb1c31a8dfa3e4113f59bfe40cd71
I'm trying to use the portal for screensharing, but it's being a bit wonky.
First I tried it in a Chrome-based browser (Brave), where I need to click through the xdph UI twice for the screeenshare to work and checking the restore token thing didn't work.
Then I tried it in Firefox, where the xdph UI shows only once, but the restore token didn't work on subsequent share either.
I decided to look in the logs and it turns out that xdph is segfaulting on screenshare end. I guess this is why the restore token doesn't work (because there's no chance for it to be persisted before the segfault takes the process down) and why Chrome shows the dialog twice – first for the tiny screen previews in it's own selection dialog, then when I select one the screenshare session for thumbnails finishes, xdph segfaults and gets restarted by systemd and since there was no chance for the token to get persisted, so I get the xdph UI again.
Here's the stacktrace in question:
When I ran xdph with
--verbose
it had a lot of additional logging (I can post whole log if you need it, but it's a lot ofgot poll event
s, so I decided to omit it for now) and I think the interesting part was here:Where we can see that we get a
nullptr
here – https://github.com/hyprwm/xdg-desktop-portal-hyprland/blob/master/src/portals/Screencopy.cpp#L1119 – that is then dereferenced a couple lines later. I guess this means there's some race condition between the session being closed and xdph trying to access the last frame's data. Simply checking fornullptr
inenqueue
fixes the segfault, but it doesn't make the restore token work in neither of Brave nor Firefox – so either it's unrelated, or maybe a correct fix would be more complicated.EDIT: I guess this might be related to this fix, because it looks like it fixed stream cleanup on session close – https://github.com/hyprwm/xdg-desktop-portal-hyprland/pull/130.