Prevent recursion on the MainWindow.cleanup() call by setting an in-progress attribute

This commit is contained in:
Miguel Jacq 2025-02-15 20:33:03 +11:00
parent 4fbe981c31
commit 2b6f3cfbe3
No known key found for this signature in database
GPG Key ID: 59B3F0C24135C6A9

View File

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