From 2b6f3cfbe3928430b4bf416287a635029cce040e Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sat, 15 Feb 2025 20:33:03 +1100 Subject: [PATCH] Prevent recursion on the MainWindow.cleanup() call by setting an in-progress attribute --- desktop/onionshare/main_window.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktop/onionshare/main_window.py b/desktop/onionshare/main_window.py index 986f8720..416eb194 100644 --- a/desktop/onionshare/main_window.py +++ b/desktop/onionshare/main_window.py @@ -284,6 +284,10 @@ class MainWindow(QtWidgets.QMainWindow): Alert(self.common, notice, QtWidgets.QMessageBox.Information) def cleanup(self): + if hasattr(self, "_cleanup_in_progress") and self._cleanup_in_progress: + return + self._cleanup_in_progress = True + self.common.log("MainWindow", "cleanup") self.tabs.cleanup() @@ -314,6 +318,8 @@ class MainWindow(QtWidgets.QMainWindow): # Wait 1 second for threads to close gracefully, so tests finally pass time.sleep(1) + self._cleanup_in_progress = False + def resizeEvent(self, event: QtGui.QResizeEvent): self.window_resized.emit() return super(MainWindow, self).resizeEvent(event)