Catch the exception on device attach/detach
Take care to release lock before anything else, otherwise GUI will be frozen...
This commit is contained in:
parent
da0d0c29b8
commit
19b9ffefda
@ -1847,11 +1847,15 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
vm = self.get_selected_vm()
|
vm = self.get_selected_vm()
|
||||||
|
|
||||||
self.blk_manager.blk_lock.acquire()
|
self.blk_manager.blk_lock.acquire()
|
||||||
if dev in self.blk_manager.attached_devs:
|
try:
|
||||||
self.blk_manager.detach_device(vm, dev)
|
if dev in self.blk_manager.attached_devs:
|
||||||
else:
|
self.blk_manager.detach_device(vm, dev)
|
||||||
self.blk_manager.attach_device(vm, dev)
|
else:
|
||||||
self.blk_manager.blk_lock.release()
|
self.blk_manager.attach_device(vm, dev)
|
||||||
|
self.blk_manager.blk_lock.release()
|
||||||
|
except QubesException as e:
|
||||||
|
self.blk_manager.blk_lock.release()
|
||||||
|
QMessageBox.critical(None, "Block attach/detach error!", str(e))
|
||||||
|
|
||||||
|
|
||||||
class QubesBlockDevicesManager():
|
class QubesBlockDevicesManager():
|
||||||
|
Loading…
Reference in New Issue
Block a user