[gnome-boxes] Fix critical error when exiting display mode early



commit f4505d6c4366b2bcc363c280aa15a52bb435c36d
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Sep 6 20:19:35 2012 +0200

    Fix critical error when exiting display mode early
    
    If you go back to the collection view really fast, before the zoom
    from CREDS to DISPLAY is finished you get an critical:
    
    (gnome-boxes:32269): Boxes-CRITICAL **: boxes_display_get_display: assertion `self != NULL' failed
    
    This is because the timeout set up to switch to display mode after the
    animation is not cleaned up. Fix this by removing the timeout when
    disconnecting the show signal handler.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683522

 src/machine.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index c3d49f2..dc23ca5 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -15,6 +15,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
 
     private ulong show_id;
     private ulong hide_id;
+    private uint show_timeout_id;
     private ulong disconnected_id;
     private ulong need_password_id;
     private ulong need_username_id;
@@ -79,6 +80,9 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             if (_display != null) {
                 _display.disconnect (show_id);
                 show_id = 0;
+                if (show_timeout_id != 0)
+                    GLib.Source.remove (show_timeout_id);
+                show_timeout_id = 0;
                 _display.disconnect (hide_id);
                 hide_id = 0;
                 _display.disconnect (disconnected_id);
@@ -100,7 +104,8 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
                 switch (App.app.ui_state) {
                 case Boxes.UIState.CREDS:
                     App.app.ui_state = Boxes.UIState.DISPLAY;
-                    Timeout.add (App.app.duration, () => {
+                    show_timeout_id = Timeout.add (App.app.duration, () => {
+                        show_timeout_id = 0;
                         show_display ();
                         return false;
                      });



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