From f408f8a466d795aa157a57e606f7b95284eb148e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Dec 2020 18:23:49 +0530 Subject: [PATCH] Dont try to show a dialog when calling shutdown_other with a QApplication --- src/calibre/gui2/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index a09c0f721e..776f8bebfb 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -437,9 +437,10 @@ def send_message(msg): except Exception as err: print(_('Failed to contact running instance of calibre'), file=sys.stderr, flush=True) print(err, file=sys.stderr, flush=True) - error_dialog(None, _('Contacting calibre failed'), _( - 'Failed to contact running instance of calibre, try restarting calibre'), - det_msg=str(err) + '\n\n' + repr(msg), show=True) + if Application.instance(): + error_dialog(None, _('Contacting calibre failed'), _( + 'Failed to contact running instance of calibre, try restarting calibre'), + det_msg=str(err) + '\n\n' + repr(msg), show=True) return False return True