details: Don't traceback if VM deleted with open details window

When a VM is undefined, whether explicitly through virt-manager or behind
our back, we close and cleanup any associated vmmDetails windows. However
there's a race here: if the details window is the last remaining top
level window, cleanup() is called twice which tracebacks.

Fix this by dispatching the exit_app routine in an idle callback, to
avoid racing with any window delete routines.

Reported-by: Leonardo Garcia <lagarcia@br.ibm.com>
This commit is contained in:
Cole Robinson 2013-06-11 10:44:25 -04:00
parent 665375db1b
commit ff297777cc

View File

@ -331,7 +331,9 @@ class vmmEngine(vmmGObject):
if (self.windows <= 0 and
self.systray and
not self.systray.is_visible()):
self.exit_app(src)
# Defer this to an idle callback, since we can race with
# a vmmDetails window being deleted.
self.idle_add(self.exit_app, src)
def _cleanup(self):
uihelpers.cleanup()