[gtk-vnc] Avoid crash if framebuffer is not set & silence warning



commit 58012cdb3cf8f5ab1ee630ddb9c47acd35991df1
Author: Daniel P. Berrange <berrange redhat com>
Date:   Sat Mar 20 22:07:43 2010 +0000

    Avoid crash if framebuffer is not set & silence warning
    
    * src/vncdisplay.c: Avoid possible crash if framebuffer isn't set
    * src/vncconnection.c: Avoid warning when sasl is not enabled

 src/vncconnection.c |    2 +-
 src/vncdisplay.c    |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 15f6691..dc1d30f 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -715,10 +715,10 @@ static int vnc_connection_read_plain(VncConnection *conn)
  */
 static int vnc_connection_read_buf(VncConnection *conn)
 {
+#if HAVE_SASL
 	VncConnectionPrivate *priv = conn->priv;
 
 	//GVNC_DEBUG("Start read %d", priv->has_error);
-#if HAVE_SASL
 	if (priv->saslconn)
 		return vnc_connection_read_sasl(conn);
 	else
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index a0ee28d..f2cce4e 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -274,10 +274,12 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
 	GdkRectangle drawn;
 	GdkRegion *clear, *copy;
 #endif
-	int fbw, fbh;
+	int fbw = 0, fbh = 0;
 
-	fbw = vnc_framebuffer_get_width(VNC_FRAMEBUFFER(priv->fb));
-	fbh = vnc_framebuffer_get_height(VNC_FRAMEBUFFER(priv->fb));
+	if (priv->fb) {
+		fbw = vnc_framebuffer_get_width(VNC_FRAMEBUFFER(priv->fb));
+		fbh = vnc_framebuffer_get_height(VNC_FRAMEBUFFER(priv->fb));
+	}
 
 	GVNC_DEBUG("Expose area %dx%d at location %d,%d",
 		   expose->area.width,



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