Skip to content

screen: refresh stale ordered screen tables on hotplug - #34

Open
mxmilkiib wants to merge 1 commit into
Elv13:masterfrom
mxmilkiib:fix-stale-screen-tables
Open

mxmilkiib wants to merge 1 commit into
Elv13:masterfrom
mxmilkiib:fix-stale-screen-tables

Conversation

@mxmilkiib

Copy link
Copy Markdown

Summary

  • screen.lua captured screens/screens_inv once at module load, while util.get_ordered_screens() invalidates its own cache on added/removed signals
  • After an output hotplug, screens_inv[ss] returned nil for the current screen, and capi.screen[nil].index crashed with "attempt to index a nil value"
  • next_screen() and module.select_screen() now fetch fresh tables per call and bail out gracefully when the lookup fails

Test plan

  • luac -p screen.lua parses cleanly
  • Reproduced crash path on a Wayland compositor (somewm) where outputs hotplug after config load
  • Verify screen switching still cycles in correct geometric order on multi-head setup

Generated with Devin

The module captured screens and screens_inv once at load time, while
util.get_ordered_screens() invalidates its own cache on screen added/
removed signals. After an output hotplug the stale tables no longer
contained the current screen object, so screens_inv[ss] returned nil
and capi.screen[nil].index raised 'attempt to index a nil value'.

Fetch fresh tables in next_screen() and module.select_screen() and bail
out gracefully when the lookup fails.
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