From 8b704a007050048a0e51d90e89af3e15e7b218b4 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 19 Sep 2018 15:07:04 +1000 Subject: [PATCH] Start the WebThread earlier than the Onion service. This gives it a chance to generate its slug before the Onion Service finishes starting up, which can otherwise lead to a crash --- onionshare_gui/threads.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/onionshare_gui/threads.py b/onionshare_gui/threads.py index f4acc5e1..2af0120d 100644 --- a/onionshare_gui/threads.py +++ b/onionshare_gui/threads.py @@ -41,14 +41,6 @@ class OnionThread(QtCore.QThread): def run(self): self.mode.common.log('OnionThread', 'run') - try: - self.mode.app.start_onion_service() - self.success.emit() - - except (TorTooOld, TorErrorInvalidSetting, TorErrorAutomatic, TorErrorSocketPort, TorErrorSocketFile, TorErrorMissingPassword, TorErrorUnreadableCookieFile, TorErrorAuthError, TorErrorProtocolError, BundledTorTimeout, OSError) as e: - self.error.emit(e.args[0]) - return - self.mode.app.stay_open = not self.mode.common.settings.get('close_after_first_download') # start onionshare http service in new thread @@ -58,6 +50,14 @@ class OnionThread(QtCore.QThread): # wait for modules in thread to load, preventing a thread-related cx_Freeze crash time.sleep(0.2) + try: + self.mode.app.start_onion_service() + self.success.emit() + + except (TorTooOld, TorErrorInvalidSetting, TorErrorAutomatic, TorErrorSocketPort, TorErrorSocketFile, TorErrorMissingPassword, TorErrorUnreadableCookieFile, TorErrorAuthError, TorErrorProtocolError, BundledTorTimeout, OSError) as e: + self.error.emit(e.args[0]) + return + class WebThread(QtCore.QThread): """