Skip to content

screensaver-proxy: stop losing track of inhibitors - #465

Open
tangles-0 wants to merge 1 commit into
linuxmint:masterfrom
tangles-0:fix/screensaver-proxy-inhibitor-tracking
Open

screensaver-proxy: stop losing track of inhibitors#465
tangles-0 wants to merge 1 commit into
linuxmint:masterfrom
tangles-0:fix/screensaver-proxy-inhibitor-tracking

Conversation

@tangles-0

@tangles-0 tangles-0 commented Jul 25, 2026

Copy link
Copy Markdown

Summary

the csd-screensaver-proxy disconnect callback ends with:

g_hash_table_remove (manager->priv->watch_ht, sender);

But sender is merely the last hash-table entry inspected.

I tracked this down because I got sick of the game i'm developing crashing and causing my monitor to stay awake forever. the Cinnamon lock screen is burned into my OLED :(

This PR:

  • removes the name watch for the client that actually vanished instead of whichever sender happened to be visited last in the cookie hash table
  • forget cookies after an explicit UnInhibit, preventing a second cleanup attempt and the resulting invalid-cookie error
  • preserve cleanup watches for concurrent clients so a later crash cannot leave an idle inhibitor behind

How i fixed the bug and tested my fix

  • configured and built the daemon with Meson
  • ran an isolated dbus-run-session test script with 12 concurrent clients and verified every cookie was released when its owning connection disappeared
  • verified a proper UnInhibit is forwarded exactly once when that client later disconnects
  • with the patch applied to my system i put a deliberate code error in my Godot-based game and spawned 20 game processes simultaneously, which would reliably reproduce the bug ten times out of ten on the unpatched proxy. 20 clients acquired inhibitors, all 20 were cleaned up on disconnect, and no invalid-cookie errors were logged

remove the watch for the client that actually vanished, and forget cookies once explicitly released. otherwise concurrent clients can steal each other's cleanup watches and leave the display awake.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants