Skip to content

Conversation

@Ferdi265
Copy link

@Ferdi265 Ferdi265 commented Jul 14, 2025

This PR fixes a crash in UpdateCursor() that occurs when switching TTYs due to m_pPointer (a wl_pointer*) being null.

This can happen when the seat loses pointer capability, such as when switching to another TTY on Sway.

The fix is just to ignore the cursor update with an early return when there is no wl_pointer, same as SetRelativeMouseMode() already does.

This PR makes it possible to use screen lockers that switch TTY or use multiple sessions on different TTYs while gamescope is active without the whole gamescope session crashing.

Fixes #1920.

@Ferdi265 Ferdi265 force-pushed the fix-null-wl-pointer-crash branch from ab24255 to 52ed746 Compare July 14, 2025 20:43
@Ferdi265
Copy link
Author

improved the commit message by mentioning the function where the crash occurs.

@Ferdi265
Copy link
Author

Ferdi265 commented Aug 4, 2025

@misyltoad / @lostgoat, could someone of you take a look at this? It's a ~1line change (a single early return / null ptr check) and does not have any impact on use when not switching TTYs.

@Ferdi265 Ferdi265 force-pushed the fix-null-wl-pointer-crash branch from 52ed746 to a28ca7a Compare August 7, 2025 21:40
This can happen when the seat loses pointer capability, such as when
switching to another TTY on Sway.
@Ferdi265 Ferdi265 force-pushed the fix-null-wl-pointer-crash branch from a28ca7a to 7c072d7 Compare September 23, 2025 21:57
@Ferdi265
Copy link
Author

rebased onto latest master

Copy link
Collaborator

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@emersion emersion merged commit 0d3a197 into ValveSoftware:master Oct 4, 2025
1 check passed
@Ferdi265 Ferdi265 deleted the fix-null-wl-pointer-crash branch October 17, 2025 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gamescope segfaults when switching TTY

2 participants