Fix start server button in preferences causing a hang if the server fails to start

This commit is contained in:
Kovid Goyal 2017-05-25 20:38:36 +05:30
parent 7c3e05313d
commit 03226f2d34
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 0 deletions

View File

@ -798,6 +798,7 @@ class ConfigWidget(ConfigWidgetBase):
_('Failed to start content server'),
as_unicode(self.gui.content_server.exception)
).exec_()
self.gui.content_server = None
return
self.main_tab.update_button_state()
finally:

View File

@ -64,6 +64,7 @@ class Server(object):
self.loop.initialize_socket()
except Exception as e:
self.loop = None
self.exception = e
if self.start_failure_callback is not None:
try:
self.start_failure_callback(as_unicode(e))
@ -86,6 +87,7 @@ class Server(object):
from calibre.utils.rapydscript import compile_srv
compile_srv()
except BaseException as e:
self.exception = e
if self.start_failure_callback is not None:
try:
self.start_failure_callback(as_unicode(e))