Skip to content

passwordEntry: guard against None layout sources#504

Open
H3xano wants to merge 1 commit into
linuxmint:masterfrom
H3xano:fix/restore-layout-none-guard
Open

passwordEntry: guard against None layout sources#504
H3xano wants to merge 1 commit into
linuxmint:masterfrom
H3xano:fix/restore-layout-none-guard

Conversation

@H3xano
Copy link
Copy Markdown

@H3xano H3xano commented May 29, 2026

When the screensaver fails to connect to Cinnamon (this is logged as
"Failed to connect to Cinnamon - screensaver will not activate when
expo or overview modes are active"), lockscreen_layout_source and
system_layout_source remain None (initialized at init but
only set in on_layout_sources_changed if the Cinnamon dbus
connection succeeds).

Three methods then crash by dereferencing them:

  • restore_original_layout(): AttributeError: 'NoneType' object has no attribute 'index'
  • on_draw(): AttributeError on .flag_name / .short_name
  • update_layout_icon(): AttributeError on .display_name

The crash in restore_original_layout() was consistently reproducible
on every unlock on an NVIDIA system (Cinnamon 6.6.x, Linux Mint Zena,
single us keyboard layout) where the Cinnamon dbus connection was
unavailable at screensaver start.

Fix: add early-return guards at the top of all three affected methods.

When the screensaver fails to connect to Cinnamon (logged as
'Failed to connect to Cinnamon'), lockscreen_layout_source and
system_layout_source remain None. Three methods then crash
dereferencing them:

- restore_original_layout(): AttributeError on .index
- on_draw(): AttributeError on .flag_name / .short_name
- update_layout_icon(): AttributeError on .display_name

Add early-return guards in all three methods.

Reproduces on: Cinnamon 6.6.x, NVIDIA GPU, single keyboard layout (us),
after unlock from screensaver.
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.

1 participant