From 950fe9253c84b934306e9bb14c344a748c0223ce Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Wed, 6 Feb 2013 14:57:09 +0100 Subject: [PATCH] fix race condition in get_selected_vm Reported-by: Hakisho Nukama --- qubesmanager/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 5ef6b98..daef414 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -1171,7 +1171,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): #vm selection relies on the VmInfo widget's value used for sorting by VM name row_index = self.table.currentRow() if row_index != -1: - qid = self.table.item(row_index, self.columns_indices["Name"]).qid + vm_item = self.table.item(row_index, self.columns_indices["Name"]) + # here is possible race with update_table timer so check if really got the item + if vm_item is None: + return None + qid = vm_item.qid assert self.vms_in_table[qid] is not None vm = self.vms_in_table[qid].vm return vm