[Pkg-privacy-commits] [onionshare] 49/55: Sleep between launching threads in onionshare-gui, preventing a cx_Freeze crash related to loading the same modules in multiple threads while they're locked

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Sep 8 10:27:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch debian
in repository onionshare.

commit 373f24e64b52aea6ad9dc5caeb9073e728abec2f
Author: Micah Lee <micah at micahflee.com>
Date:   Tue Sep 6 13:27:59 2016 -0700

    Sleep between launching threads in onionshare-gui, preventing a cx_Freeze crash related to loading the same modules in multiple threads while they're locked
---
 onionshare_gui/onionshare_gui.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 032140d..cbda543 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -144,6 +144,13 @@ class OnionShareGui(QtWidgets.QMainWindow):
         # pick an available local port for the http service to listen on
         self.app.choose_port()
 
+        # start onionshare http service in new thread
+        t = threading.Thread(target=web.start, args=(self.app.port, self.app.stay_open, self.app.transparent_torification))
+        t.daemon = True
+        t.start()
+        # wait for modules in thread to load, preventing a thread-related cx_Freeze crash
+        time.sleep(0.2)
+
         # start the onion service in a new thread
         def start_onion_service(self):
             self.status_bar.showMessage(strings._('gui_starting_server1', True))
@@ -155,14 +162,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
                 self.starting_server_error.emit(e.args[0])
                 return
 
-        t1 = threading.Thread(target=start_onion_service, kwargs={'self': self})
-        t1.daemon = True
-        t1.start()
-
-        # start onionshare http service in new thread
-        t2 = threading.Thread(target=web.start, args=(self.app.port, self.app.stay_open, self.app.transparent_torification))
-        t2.daemon = True
-        t2.start()
+        t = threading.Thread(target=start_onion_service, kwargs={'self': self})
+        t.daemon = True
+        t.start()
 
     def start_server_step2(self):
         """

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git



More information about the Pkg-privacy-commits mailing list