mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 10:42:58 -03:00
Clean up watchdog thread when quitting, which avoids segfaults
This commit is contained in:
parent
76d88d0648
commit
aebc96142f
2 changed files with 11 additions and 3 deletions
|
@ -284,7 +284,5 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
e.accept()
|
e.accept()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
for index in range(self.tabs.count()):
|
self.tabs.cleanup()
|
||||||
tab = self.tabs.widget(index)
|
|
||||||
tab.cleanup()
|
|
||||||
self.common.gui.onion.cleanup()
|
self.common.gui.onion.cleanup()
|
||||||
|
|
|
@ -79,6 +79,16 @@ class TabWidget(QtWidgets.QTabWidget):
|
||||||
self.observer.schedule(self.event_handler, self.common.gui.events_dir)
|
self.observer.schedule(self.event_handler, self.common.gui.events_dir)
|
||||||
self.observer.start()
|
self.observer.start()
|
||||||
|
|
||||||
|
def cleanup(self):
|
||||||
|
# Stop the event thread
|
||||||
|
self.observer.stop()
|
||||||
|
self.observer.join()
|
||||||
|
|
||||||
|
# Clean up each tab
|
||||||
|
for index in range(self.count()):
|
||||||
|
tab = self.widget(index)
|
||||||
|
tab.cleanup()
|
||||||
|
|
||||||
def move_new_tab_button(self):
|
def move_new_tab_button(self):
|
||||||
# Find the width of all tabs
|
# Find the width of all tabs
|
||||||
tabs_width = sum(
|
tabs_width = sum(
|
||||||
|
|
Loading…
Add table
Reference in a new issue