From 22a9823871a8ea17880a584a83be57e44da05bb6 Mon Sep 17 00:00:00 2001 From: donoban Date: Sun, 25 Nov 2018 18:37:34 +0100 Subject: [PATCH] Fix iterating and removing over list Return after removing and raise exception if removable item not found --- qubesmanager/qube_manager.py | 3 +++ qubesmanager/settings.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 9570fa4..48a3532 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -494,6 +494,9 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.tr(msg)) self.threads_list.remove(thread) + return + + raise RuntimeError('No finished thread found') def closeEvent(self, event): # pylint: disable=invalid-name diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 952916c..ffa5fe3 100755 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -240,10 +240,13 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.tr(msg)) self.threads_list.remove(thread) + return if self.thread_closes: self.done(0) + raise RuntimeError('No finished thread found') + def keyPressEvent(self, event): # pylint: disable=invalid-name if event.key() == QtCore.Qt.Key_Enter \ or event.key() == QtCore.Qt.Key_Return: