alex-courtis / way-displays

way-displays: Auto Manage Your Wayland Displays
MIT License
241 stars 12 forks source link

Warn if unable to discover laptop lid #42

Closed j0057 closed 2 years ago

j0057 commented 2 years ago

Fix a segfault where (due to misconfiguration) way-displays cannot create a libinput monitor for the laptop lid, in my case because my user account was missing membership of the input group. When this is the case, lid_init exits early, without initializing the lid object, and lid_is_closed will segfault when trying to access lid->closed.

j0057 commented 2 years ago

This is the segfault that prevented way-displays from starting up since version 1.5.0:

Stack trace of thread 22510:
#0  0x00005631edf71d99 lid_is_closed (way-displays + 0xcd99)
#1  0x00005631edf702af print_head_current (way-displays + 0xb2af)
#2  0x00005631edf70b34 print_head (way-displays + 0xbb34)
#3  0x00005631edf7160c layout (way-displays + 0xc60c)
#4  0x00005631edf75704 loop (way-displays + 0x10704)
#5  0x00005631edf758b9 server (way-displays + 0x108b9)
#6  0x00007f9bbbc29290 n/a (libc.so.6 + 0x29290)
#7  0x00007f9bbbc2934a __libc_start_main (libc.so.6 + 0x2934a)
#8  0x00005631edf6dfc5 _start (way-displays + 0x8fc5)