mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-09 09:55:00 -04:00
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:
parent
64227a9445
commit
12c84f03cd
2 changed files with 7 additions and 2 deletions
|
@ -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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import time
|
||||||
from PySide2 import QtCore, QtWidgets, QtGui
|
from PySide2 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
from onionshare_cli.web import Web
|
from onionshare_cli.web import Web
|
||||||
|
@ -286,3 +287,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
self.tabs.cleanup()
|
self.tabs.cleanup()
|
||||||
self.common.gui.onion.cleanup()
|
self.common.gui.onion.cleanup()
|
||||||
|
|
||||||
|
# Wait 1 second for threads to close gracefully, so tests finally pass
|
||||||
|
time.sleep(1)
|
||||||
|
|
|
@ -663,6 +663,7 @@ class Tab(QtWidgets.QWidget):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
if self.get_mode() and self.get_mode().web_thread:
|
||||||
self.get_mode().web_thread.quit()
|
self.get_mode().web_thread.quit()
|
||||||
self.get_mode().web_thread.wait()
|
self.get_mode().web_thread.wait()
|
||||||
self.app.cleanup()
|
self.app.cleanup()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue