mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-manager: Gracefully exit app on ctrl-c, not sys.exit
Will be needed for uitests coverage support
This commit is contained in:
parent
044d93d471
commit
ab1b4f8628
@ -272,17 +272,17 @@ def main():
|
||||
LibvirtGLib.init(None)
|
||||
LibvirtGLib.event_register()
|
||||
|
||||
engine = vmmEngine()
|
||||
|
||||
# Actually exit when we receive ctrl-c
|
||||
from gi.repository import GLib
|
||||
def _sigint_handler(user_data):
|
||||
ignore = user_data
|
||||
logging.debug("Received KeyboardInterrupt. Exiting application.")
|
||||
sys.exit(0)
|
||||
engine.exit_app(None)
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT,
|
||||
_sigint_handler, None)
|
||||
|
||||
engine = vmmEngine()
|
||||
|
||||
engine.start(options.uri, show_window, domain, options.skip_autostart)
|
||||
|
||||
|
||||
|
@ -482,7 +482,7 @@ class vmmEngine(vmmGObject):
|
||||
# Engine will always appear to leak
|
||||
objs.remove(self.object_key)
|
||||
|
||||
if src.object_key in objs:
|
||||
if src and src.object_key in objs:
|
||||
# UI that initiates the app exit will always appear to leak
|
||||
objs.remove(src.object_key)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user