GNOME Bugzilla – Bug 683792
Fix criticals when exiting boxes on wizard summary screen
Last modified: 2016-03-31 14:00:19 UTC
If you quit boxes while it's at the wizard summary screen, some criticals appear in the console, these patches fixes those.
Created attachment 224012 [details] [review] Make Machine::get_screenshot_filename private It's only used in machine.vala
Created attachment 224013 [details] [review] Report errors in Machine::get_screenshot_filename() When the VM has just been created, config.uuid is not known yet. When we quit Boxes from the wizard summary screen, the VM is deleted when it's in such a state, which causes Criticals on the console when it tries to delete the VM screenshot: (gnome-boxes:5027): Boxes-CRITICAL **: boxes_get_screenshot_filename: assertion `prefix != NULL' failed This commit changes get_screenshot_filename() to report errors by throwing a Boxes.Error exception and catches it in callers. This removes the get_screenshot_filename() criticals in the scenario described above.
Created attachment 224014 [details] [review] Destroy the main window at the end of App::quit() When exiting Boxes at the wizard summary screen, these warnings appear (gnome-boxes:2076): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkLabel' (gnome-boxes:2076): Gtk-CRITICAL **: gtk_label_set_markup: assertion `GTK_IS_LABEL (label)' failed (gnome-boxes:2635): Gtk-CRITICAL **: gtk_widget_hide: assertion `GTK_IS_WIDGET (widget)' failed (gnome-boxes:2635): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkLabel' (gnome-boxes:2635): Gtk-CRITICAL **: gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed (gnome-boxes:2635): Gtk-CRITICAL **: gtk_widget_show: assertion `GTK_IS_WIDGET (widget)' failed This occurs because on exit, App::quit() is called, which invokes in turn window.destroy (); and then wizard.cleanup (); window.destroy (); destroys some of the widgets used by Boxes, in particular the GdMainToolbars used in topbar.vala. wizard.cleanup (); will delete the machine that was being created. This will in particular trigger a call to Topbar::update_selection_label (); which will try to use the already destroyed GdMainToolbar, causing these warnings. This commit moves windows destruction until the end of App::quit () so that Boxes UI stays alive until we have done the various cleanups we have to. A possibly better fix would be to have a BoxesAppWindow class deriving from GtkApplicationWindow which would make sure Boxes UI gets all cleaned up when it's destroyed, but this was a more invasive fix...
Review of attachment 224013 [details] [review]: ack
Review of attachment 224014 [details] [review]: ack
Review of attachment 224012 [details] [review]: ack
Attachment 224012 [details] pushed as 571fcd1 - Make Machine::get_screenshot_filename private Attachment 224013 [details] pushed as b04e43f - Report errors in Machine::get_screenshot_filename() Attachment 224014 [details] pushed as 3acc7e4 - Destroy the main window at the end of App::quit()