Clean up watchdog thread when quitting, which avoids segfaults

This commit is contained in:
Micah Lee 2020-03-22 21:32:53 -07:00
parent 76d88d0648
commit aebc96142f
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 11 additions and 3 deletions

View File

@ -284,7 +284,5 @@ class MainWindow(QtWidgets.QMainWindow):
e.accept()
def cleanup(self):
for index in range(self.tabs.count()):
tab = self.tabs.widget(index)
tab.cleanup()
self.tabs.cleanup()
self.common.gui.onion.cleanup()

View File

@ -79,6 +79,16 @@ class TabWidget(QtWidgets.QTabWidget):
self.observer.schedule(self.event_handler, self.common.gui.events_dir)
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):
# Find the width of all tabs
tabs_width = sum(