Philipp Hörist pushed to branch master at gajim / gajim


Commits:
37d017a7 by Philipp Hörist at 2024-02-04T17:53:07+01:00
fix: DBus: Don’t fail if no file descriptor list is returned

- - - - -


1 changed file:

- gajim/common/dbus/logind.py


Changes:

=====================================
gajim/common/dbus/logind.py
=====================================
@@ -82,6 +82,7 @@ def _obtain_delay_inhibitor(self, connection: 
Gio.DBusConnection) -> None:
             # yet another one.
             log.warning('Trying to obtain a shutdown inhibitor '
                         'while already holding one.')
+            return
 
         try:
             result = connection.call_with_unix_fd_list_sync(
@@ -100,14 +101,18 @@ def _obtain_delay_inhibitor(self, connection: 
Gio.DBusConnection) -> None:
                 -1,
                 None,
                 None)
-
-            ret, ret_fdlist = result
         except GLib.Error as error:
             log.warning(
                 'Could not obtain a shutdown delay inhibitor from '
                 'logind: %s', error)
             return
 
+        ret, ret_fdlist = result
+        if ret_fdlist is None:  # pyright: ignore
+            # This can happen as reported by users
+            log.warning('Unable to obtain inhibitor, fdlist is None')
+            return
+
         self._inhibit_fd = ret_fdlist.get(ret.unpack()[0])
         log.info('Obtained shutdown delay inhibitor')
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/37d017a7f83ead8ac922668578e51d174bf96342

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/37d017a7f83ead8ac922668578e51d174bf96342
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to