[gnome-boxes] spice: do not call get_pixbuf() if the display is not ready



commit 33568771f076fccf42a08524c1cf583c35a27d3d
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Mon Sep 3 16:36:27 2012 +0200

    spice: do not call get_pixbuf() if the display is not ready
    
    Avoid the infamous d->data != NULL critical when the display is not
    ready. Sadly, get_pixbuf() doesn't raise errors, so it makes sense to
    not call the function when the display is not ready.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683274

 src/spice-display.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index c4f4a09..7294fac 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -91,7 +91,12 @@ private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IPropertiesProvider {
     }
 
     public override Gdk.Pixbuf? get_pixbuf (int n) throws Boxes.Error {
-        return (get_display (n) as Spice.Display).get_pixbuf ();
+        var display = get_display (n) as Spice.Display;
+
+        if (!display.ready)
+            return null;
+
+        return display.get_pixbuf ();
     }
 
     public override void connect_it () {



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