[gnome-boxes] spice: do not get_display(0) before it is ready



commit 3139eb52ed99771c7ce16fa14a3009b3d71a7235
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Fri Jun 22 13:44:32 2012 +0200

    spice: do not get_display(0) before it is ready
    
    Only when Boxes.Display::show() has been emitted are we allowed
    to get_display(), which is also fine in DISPLAY and PROPERTIES
    ui_state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678624

 src/spice-display.vala |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 05fb679..92e187d 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -18,12 +18,11 @@ private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IPropertiesProvider {
     private void ui_state_changed () {
         // TODO: multi display
         try {
-            var display = get_display (0) as Spice.Display;
-            if (App.app.ui_state == UIState.PROPERTIES) {
+            if (App.app.ui_state == UIState.PROPERTIES ||
+                App.app.ui_state == UIState.DISPLAY) {
                 // disable resize guest when minimizing guest widget
-                display.resize_guest = false;
-            } else if (App.app.ui_state == UIState.DISPLAY) {
-                display.resize_guest = resize_guest;
+                var display = get_display (0) as Spice.Display;
+                display.resize_guest = App.app.ui_state == UIState.DISPLAY ? resize_guest : false;
             }
         } catch (Boxes.Error error) {
         }



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