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


Commits:
94b163c6 by Philipp Hörist at 2026-07-07T18:06:19+03:00
fix: TrayIcon: Close FD, when updating the icon

- - - - -


1 changed file:

- gajim/gtk/tray_icon.py


Changes:

=====================================
gajim/gtk/tray_icon.py
=====================================
@@ -12,6 +12,7 @@
 from __future__ import annotations
 
 from typing import Any
+from typing import TYPE_CHECKING
 
 import logging
 import sys
@@ -39,7 +40,7 @@
 
 log = logging.getLogger("gajim.gtk.trayicon")
 
-if sys.platform == "win32":
+if sys.platform == "win32" or TYPE_CHECKING:
     import pystray
     from PIL import Image
 
@@ -184,7 +185,6 @@ def shutdown(self) -> None:
         self._tray_icon.stop()
 
     def _create_tray_icon(self) -> pystray.Icon:
-        assert pystray  # type: ignore
         menu_items: list[pystray.MenuItem] = [
             pystray.MenuItem(
                 text=_("Show/Hide Window"),
@@ -256,7 +256,9 @@ def _get_icon(icon_name: str) -> Image.Image:
             / "status"
             / f"{tray_icon_name}.png"
         )
-        return Image.open(path)  # type: ignore
+        with Image.open(path) as image:
+            image.load()
+        return image
 
 
 class LinuxTrayIcon(TrayIconBackend):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/94b163c6b8b18c1eb119ab7d07fa554ee4bfb425

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/94b163c6b8b18c1eb119ab7d07fa554ee4bfb425
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