mirror of
https://github.com/fergalmoran/picard.git
synced 2025-12-22 09:18:18 +00:00
Only register sys.excepthook if the app actually started
Without this patch, when running tests the crash message box may be displayed. With those changes, it will be displayed only if the app was actually started.
This commit is contained in:
committed by
Philipp Wolfer
parent
d7bb9dc0a2
commit
eec6513ce8
@@ -132,10 +132,10 @@ def crash_handler(exc: Exception = None):
|
||||
app.quit()
|
||||
|
||||
|
||||
def register_excepthook():
|
||||
def _global_exception_handler(exctype, value, traceback):
|
||||
from picard import crash_handler
|
||||
crash_handler(exc=value)
|
||||
sys.__excepthook__(exctype, value, traceback)
|
||||
|
||||
|
||||
sys.excepthook = _global_exception_handler
|
||||
|
||||
@@ -73,6 +73,7 @@ from picard import (
|
||||
PICARD_ORG_NAME,
|
||||
acoustid,
|
||||
log,
|
||||
register_excepthook,
|
||||
)
|
||||
from picard.acoustid.manager import AcoustIDManager
|
||||
from picard.album import (
|
||||
@@ -1505,6 +1506,8 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user