mirror of
https://github.com/hyprwm/hyprlock.git
synced 2025-05-12 21:30:37 +01:00
fingerprint: handle failed dbus connection (#676)
This commit is contained in:
parent
ec82da7108
commit
ce750456f9
1 changed files with 9 additions and 2 deletions
|
@ -47,8 +47,15 @@ CFingerprint::~CFingerprint() {
|
|||
}
|
||||
|
||||
void CFingerprint::init() {
|
||||
m_sDBUSState.connection = sdbus::createSystemBusConnection();
|
||||
m_sDBUSState.login = sdbus::createProxy(*m_sDBUSState.connection, sdbus::ServiceName{"org.freedesktop.login1"}, sdbus::ObjectPath{"/org/freedesktop/login1"});
|
||||
try {
|
||||
m_sDBUSState.connection = sdbus::createSystemBusConnection();
|
||||
m_sDBUSState.login = sdbus::createProxy(*m_sDBUSState.connection, sdbus::ServiceName{"org.freedesktop.login1"}, sdbus::ObjectPath{"/org/freedesktop/login1"});
|
||||
} catch (sdbus::Error& e) {
|
||||
Debug::log(ERR, "fprint: Failed to setup dbus ({})", e.what());
|
||||
m_sDBUSState.connection.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
m_sDBUSState.login->getPropertyAsync("PreparingForSleep").onInterface(LOGIN_MANAGER).uponReplyInvoke([this](std::optional<sdbus::Error> e, sdbus::Variant preparingForSleep) {
|
||||
if (e) {
|
||||
Debug::log(WARN, "fprint: Failed getting value for PreparingForSleep: {}", e->what());
|
||||
|
|
Loading…
Reference in a new issue