mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Fix crash when monitor unplugged
`Backlight#devices_` was being destructed before `Backlight#udev_thread_`. Also check if thread is still running after `epoll_wait`
This commit is contained in:
@ -149,6 +149,9 @@ waybar::modules::Backlight::Backlight(const std::string &name,
|
||||
const int event_count =
|
||||
epoll_wait(epoll_fd.get(), events, EPOLL_MAX_EVENTS,
|
||||
std::chrono::milliseconds{interval_}.count());
|
||||
if (!udev_thread_.isRunning()) {
|
||||
break;
|
||||
}
|
||||
decltype(devices_) devices;
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(udev_thread_mutex_);
|
||||
|
Reference in New Issue
Block a user