[Spice-devel] [PATCH 1/4] gtk: warn if argument is invalid instead of crash

Alon Levy alevy at redhat.com
Wed Oct 19 02:53:11 PDT 2011


On Wed, Oct 19, 2011 at 11:29:27AM +0200, Marc-André Lureau wrote:

Series
Reviewed-by: Alon Levy <alevy at redhat.com>

> ---
>  gtk/spice-widget.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> 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;
> -- 
> 1.7.6.2
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list