aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/src/onionshare/main_window.py4
-rw-r--r--desktop/src/onionshare/tab/tab.py5
2 files changed, 7 insertions, 2 deletions
diff --git a/desktop/src/onionshare/main_window.py b/desktop/src/onionshare/main_window.py
index 38a6b275..c1e0cd1a 100644
--- a/desktop/src/onionshare/main_window.py
+++ b/desktop/src/onionshare/main_window.py
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
+import time
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.web import Web
@@ -286,3 +287,6 @@ class MainWindow(QtWidgets.QMainWindow):
def cleanup(self):
self.tabs.cleanup()
self.common.gui.onion.cleanup()
+
+ # Wait 1 second for threads to close gracefully, so tests finally pass
+ time.sleep(1)
diff --git a/desktop/src/onionshare/tab/tab.py b/desktop/src/onionshare/tab/tab.py
index b5e4e6a8..5e819405 100644
--- a/desktop/src/onionshare/tab/tab.py
+++ b/desktop/src/onionshare/tab/tab.py
@@ -663,6 +663,7 @@ class Tab(QtWidgets.QWidget):
return False
def cleanup(self):
- self.get_mode().web_thread.quit()
- self.get_mode().web_thread.wait()
+ if self.get_mode() and self.get_mode().web_thread:
+ self.get_mode().web_thread.quit()
+ self.get_mode().web_thread.wait()
self.app.cleanup()