Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch exceptions from pystray #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

digitalrane
Copy link

Currently if pystray throws any exceptions, the exception is passed through but not caught.
Without catching systray exceptions, the systray icon can be removed (i.e. by selecting Quit from the menu) without signalling to the rest of the program that it should shut down.

This happens for example if you run jellyfin-mpv-shim on a system which does not have a notifications daemon registered with dbus, pystray emits an exception when it tries to remove any lingering notifications. This fails, and jellyfin-mpv-shim is left without a systray icon, but still running in the background.

With this patch, a systray exception will gracefully terminate jellyfin-mpv-shim. It would be possible to selectively target individual exceptions which would trigger this behaviour, however looking at the other times where exceptions are caught in the codebase the try/except/pass patterns seems fairly widely used, so I went with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant