[Spice-commits] 4 commits - gtk/spice-channel.c gtk/spice-widget.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Wed Oct 19 03:04:45 PDT 2011


 gtk/spice-channel.c |    9 +++++++--
 gtk/spice-widget.c  |    9 +++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 06caae141c9bf30cd5271daf6af9ea0280ba1d5b
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Wed Oct 19 11:27:32 2011 +0200

    do not segfault if link message header size is set to 0
    
    https://bugs.freedesktop.org/show_bug.cgi?id=41988

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 5bc244f..23c16e7 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -976,6 +976,11 @@ static void spice_channel_recv_link_hdr(SpiceChannel *channel)
     }
 
     c->peer_msg = spice_malloc(c->peer_hdr.size);
+    if (c->peer_msg == NULL) {
+        g_critical("invalid peer header size: %u", c->peer_hdr.size);
+        goto error;
+    }
+
     c->state = SPICE_CHANNEL_STATE_LINK_MSG;
     return;
 
commit 0e37bf2897dd6540ed19fa6e6eddb9c2e0f03dbb
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Oct 6 19:23:17 2011 +0200

    Add SPICE_NOGRAB environment variable for debugging

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index fa7f675..5f8b301 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -406,6 +406,9 @@ static void try_keyboard_grab(SpiceDisplay *display)
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
     GdkGrabStatus status;
 
+    if (g_getenv("SPICE_NOGRAB"))
+        return;
+
     if (d->keyboard_grab_active)
         return;
 
@@ -524,6 +527,9 @@ static void try_mouse_grab(GtkWidget *widget)
     SpiceDisplay *display = SPICE_DISPLAY(widget);
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
 
+    if (g_getenv("SPICE_NOGRAB"))
+        return;
+
     if (!d->mouse_grab_enable)
         return;
     if (d->mouse_mode != SPICE_MOUSE_MODE_SERVER)
commit 8991225fdb2067aa1a13adaae2d069d3a9e1e0f1
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Sun Oct 2 23:56:37 2011 +0200

    gtk: channel-event emit an enum
    
    This doesn't break ABI, as int and enum are compatible at glib level.

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 3a17204..5bc244f 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -309,10 +309,10 @@ static void spice_channel_class_init(SpiceChannelClass *klass)
                      G_SIGNAL_RUN_FIRST,
                      G_STRUCT_OFFSET(SpiceChannelClass, channel_event),
                      NULL, NULL,
-                     g_cclosure_marshal_VOID__INT,
+                     g_cclosure_marshal_VOID__ENUM,
                      G_TYPE_NONE,
                      1,
-                     G_TYPE_INT);
+                     SPICE_TYPE_CHANNEL_EVENT);
 
     /**
      * SpiceChannel::open-fd:
commit d9fc2086909155d001cd76f4f798cce2097685ff
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Sun Oct 2 23:59:24 2011 +0200

    gtk: warn if argument is invalid instead of crash

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index afe030d..fa7f675 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -675,6 +675,7 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
 {
     SpiceDisplay *display = SPICE_DISPLAY(widget);
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+    g_return_val_if_fail(d != NULL, false);
 
     if (d->mark == 0 || d->data == NULL)
         return false;
@@ -692,6 +693,7 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
 {
     SpiceDisplay *display = SPICE_DISPLAY(widget);
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+    g_return_val_if_fail(d != NULL, false);
 
     if (d->mark == 0 || d->data == NULL)
         return false;
@@ -1349,6 +1351,7 @@ static void mark(SpiceChannel *channel, gint mark, gpointer data)
 {
     SpiceDisplay *display = data;
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+    g_return_if_fail(d != NULL);
 
     SPICE_DEBUG("widget mark: %d, channel %d", mark, d->channel_id);
     d->mark = mark;


More information about the Spice-commits mailing list