Fix very unlikely case when user right clicks the VM in the exact moment he

deletes it.
This commit is contained in:
donoban 2018-05-31 00:47:38 +02:00
parent cb5bc16948
commit b8cb0f625b
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5

View File

@ -1219,31 +1219,34 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
@QtCore.pyqtSlot('const QPoint&') @QtCore.pyqtSlot('const QPoint&')
def open_context_menu(self, point): def open_context_menu(self, point):
vm = self.get_selected_vm() try:
vm = self.get_selected_vm()
# logs menu # logs menu
self.logs_menu.clear() self.logs_menu.clear()
if vm.qid == 0: if vm.qid == 0:
logfiles = ["/var/log/xen/console/hypervisor.log"] logfiles = ["/var/log/xen/console/hypervisor.log"]
else: else:
logfiles = [ logfiles = [
"/var/log/xen/console/guest-" + vm.name + ".log", "/var/log/xen/console/guest-" + vm.name + ".log",
"/var/log/xen/console/guest-" + vm.name + "-dm.log", "/var/log/xen/console/guest-" + vm.name + "-dm.log",
"/var/log/qubes/guid." + vm.name + ".log", "/var/log/qubes/guid." + vm.name + ".log",
"/var/log/qubes/qrexec." + vm.name + ".log", "/var/log/qubes/qrexec." + vm.name + ".log",
] ]
menu_empty = True menu_empty = True
for logfile in logfiles: for logfile in logfiles:
if os.path.exists(logfile): if os.path.exists(logfile):
action = self.logs_menu.addAction(QtGui.QIcon(":/log.png"), action = self.logs_menu.addAction(QtGui.QIcon(":/log.png"),
logfile) logfile)
action.setData(logfile) action.setData(logfile)
menu_empty = False menu_empty = False
self.logs_menu.setEnabled(not menu_empty) self.logs_menu.setEnabled(not menu_empty)
self.context_menu.exec_(self.table.mapToGlobal(point)) self.context_menu.exec_(self.table.mapToGlobal(point))
except exc.QubesPropertyAccessError:
pass
@QtCore.pyqtSlot('QAction *') @QtCore.pyqtSlot('QAction *')
def show_log(self, action): def show_log(self, action):