Only close web thread on cleanup if web thread exists, and sleep 1 second when cleaning up MainWindow so loose threads can finish

This commit is contained in:
Micah Lee 2020-11-09 20:09:56 -08:00
parent f67e7ce678
commit 09d1118a94
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 7 additions and 2 deletions

View File

@ -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)

View File

@ -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()