mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 01:14:36 +02:00
Do not popup an error dialog for invalid message
Do not popup an error dialog when an invalid message is received from another instance, unless we are in DEBUG mode. See #1207947
This commit is contained in:
parent
2e3a0e57bf
commit
8da42d6a70
1 changed files with 11 additions and 2 deletions
|
|
@ -19,7 +19,7 @@
|
|||
QDialog, QSystemTrayIcon, QApplication)
|
||||
|
||||
from calibre import prints, force_unicode
|
||||
from calibre.constants import __appname__, isosx, filesystem_encoding
|
||||
from calibre.constants import __appname__, isosx, filesystem_encoding, DEBUG
|
||||
from calibre.utils.config import prefs, dynamic
|
||||
from calibre.utils.ipc.server import Server
|
||||
from calibre.db import get_db_loader
|
||||
|
|
@ -521,7 +521,16 @@ def another_instance_wants_to_talk(self):
|
|||
return
|
||||
if msg.startswith('launched:'):
|
||||
import json
|
||||
argv = json.loads(msg[len('launched:'):])
|
||||
try:
|
||||
argv = json.loads(msg[len('launched:'):])
|
||||
except ValueError:
|
||||
prints('Failed to decode message from other instance: %r' % msg)
|
||||
if DEBUG:
|
||||
error_dialog(self, 'Invalid message',
|
||||
'Received an invalid message from other calibre instance.'
|
||||
' Do you have multiple versions of calibre installed?',
|
||||
det_msg='Invalid msg: %r' % msg, show=True)
|
||||
argv = ()
|
||||
if isinstance(argv, (list, tuple)) and len(argv) > 1:
|
||||
files = [os.path.abspath(p) for p in argv[1:] if not os.path.isdir(p) and os.access(p, os.R_OK)]
|
||||
if files:
|
||||
|
|
|
|||
Loading…
Reference in a new issue