From f0e170913a51ebb9605163eddafa137053af1ed9 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 19 Jun 2014 23:00:36 -0400 Subject: [PATCH] set Qt.AA_X11InitThreads in Linux, to prevent horrible thread-related crashes --- onionshare_gui/onionshare_gui.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 85efbd1d..3cdde4ec 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -5,6 +5,14 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * +class Application(QApplication): + def __init__(self): + platform = onionshare.get_platform() + if platform == 'Tails' or platform == 'Linux': + self.setAttribute(Qt.AA_X11InitThreads, True) + + QApplication.__init__(self, sys.argv) + class WebAppThread(QThread): def __init__(self, webapp_port): QThread.__init__(self) @@ -80,7 +88,7 @@ def main(): onionshare.tails_close_port(onionshare_port) onionshare.tails_close_port(webapp_port) - app = QApplication(sys.argv) + app = Application() app.connect(app, SIGNAL("aboutToQuit()"), shutdown) # initialize the web app