GNOME Bugzilla – Bug 755082
Boxes takes way too long to shut down
Last modified: 2016-09-20 08:15:55 UTC
When I close Boxes (using the close button in the header bar, or Quit from the app menu), the Boxes window often hangs for 20-30 seconds before it disappears. The window should instead disappear immediately, and whatever shutdown work is required should occur in the background.
At first look, this seems like a gtk+ issue: https://git.gnome.org/browse/gnome-boxes/tree/src/app.vala#n267 As you can see in that code, we first hide all top-level windows and then call quit *in idle* that calls shutdown, where we suspend all machines.
Ok, I think I know what's going on. The gtk_window_hide() does not work sync and shutdown() seems to be called immediately after quit_app() returns, without getting into main loop. As part of shutdown, suspend_machines() is called and that uses a private GMainContext so we never get back to main_loop until that function returns. I'll see how I can fix this..
commit: 9e68eb05414c782910b70f36b780edcb2a371273 app: Ensure windows hidden before suspending machines