From 9393da348c3aec06cb39600632087ce7f9d9499a Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Mon, 29 Apr 2024 08:18:04 +0200 Subject: [PATCH] PICARD-2869: Run register_excepthook early Don't separately catch exceptions around main but rely on the new excepthook. This prevents the crash dialog to be shown twice for exceptions which are catched by the exception handler already. --- picard/tagger.py | 3 --- scripts/picard.in | 14 +++++--------- tagger.py.in | 14 +++++--------- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/picard/tagger.py b/picard/tagger.py index e3694eec4..0c8332462 100644 --- a/picard/tagger.py +++ b/picard/tagger.py @@ -73,7 +73,6 @@ from picard import ( PICARD_ORG_NAME, acoustid, log, - register_excepthook, ) from picard.acoustid.manager import AcoustIDManager from picard.album import ( @@ -1508,8 +1507,6 @@ If a new instance will not be spawned files/directories will be passed to the ex def main(localedir=None, autoupdate=True): - register_excepthook() - # Some libs (ie. Phonon) require those to be set QtWidgets.QApplication.setApplicationName(PICARD_APP_NAME) QtWidgets.QApplication.setOrganizationName(PICARD_ORG_NAME) diff --git a/scripts/picard.in b/scripts/picard.in index ab04f5546..4fc8c14fd 100644 --- a/scripts/picard.in +++ b/scripts/picard.in @@ -1,11 +1,7 @@ #!/usr/bin/env python3 -try: - from picard.tagger import main - main('%(localedir)s', %(autoupdate)s) -except SystemExit: - raise # Just continue with a normal application exit -except: # noqa: E722,F722 # pylint: disable=bare-except - from picard import crash_handler - crash_handler() - raise +from picard import register_excepthook +register_excepthook() + +from picard.tagger import main +main('%(localedir)s', %(autoupdate)s) diff --git a/tagger.py.in b/tagger.py.in index ff34cf871..db5c5c5af 100644 --- a/tagger.py.in +++ b/tagger.py.in @@ -12,12 +12,8 @@ if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'): else: basedir = os.path.dirname(os.path.abspath(__file__)) -try: - from picard.tagger import main - main(os.path.join(basedir, 'locale'), %(autoupdate)s) -except SystemExit: - raise # Just continue with a normal application exit -except: # noqa: E722,F722 # pylint: disable=bare-except - from picard import crash_handler - crash_handler() - raise +from picard import register_excepthook +register_excepthook() + +from picard.tagger import main +main(os.path.join(basedir, 'locale'), %(autoupdate)s)