[gnome-boxes] Don't crash when running Boxes while it's already running



commit a7d70e1dce32f1976b6e64c791bff6e12cc7fe8c
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Wed Nov 21 12:14:49 2012 +0100

    Don't crash when running Boxes while it's already running
    
    When running Boxes while an instance is already running, the
    new instance crashes in App::suspend_machines. This happens because
    App::collection is null and App::suspend_machines tries to dereference
    it. This commit just silently exits from App::suspend_machines in such
    situations as there will be no machines to save anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688789

 src/app.vala |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index d1d54db..a1dbca3 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -644,6 +644,11 @@ private class Boxes.App: Boxes.UI {
     }
 
     public void suspend_machines () {
+        // if we are not the main Boxes instance, 'collection' won't
+        // be set as it's created in GtkApplication::startup()
+        if (collection == null)
+            return;
+
         debug ("Suspending running boxes");
 
         var waiting_counter = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]