From d02fed6fef060a79c9796db7df2f7f4068a3e358 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Thu, 5 Jul 2012 01:11:39 +0200 Subject: [PATCH] Fix potential race condition in remove_vm Ensure current "vm" object. --- qubesmanager/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 013b591..2f020f4 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -1152,7 +1152,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): self.qvm_collection.lock_db_for_reading() self.qvm_collection.load() self.qvm_collection.unlock_db() - + vm = self.qvm_collection[vm.qid] + if vm.is_template(): dependent_vms = self.qvm_collection.get_vms_based_on(vm.qid) if len(dependent_vms) > 0: @@ -1196,6 +1197,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): try: self.qvm_collection.lock_db_for_writing() self.qvm_collection.load() + vm = self.qvm_collection[vm.qid] #TODO: the following two conditions should really be checked by qvm_collection.pop() overload... if vm.is_template() and self.qvm_collection.default_template_qid == vm.qid: