[Spice-devel] [PATCH spice-gtk v2 4/8] display: return NULL in spice_display_get_gl_scanout()

Pavel Grunt pgrunt at redhat.com
Wed Mar 23 19:39:22 UTC 2016


Hi Marc-André,

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> If there is no valid scanout, return NULL.

When / how it can happen ? Looking at gl_scanout() there is g_return if
scanout == NULL, if NULL is a valid/expected return value then that
g_return should be changed.

Pavel
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> ---
>  src/channel-display.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/channel-display.c b/src/channel-display.c
> index 2c54df7..90d155e 100644
> --- a/src/channel-display.c
> +++ b/src/channel-display.c
> @@ -532,7 +532,7 @@ void
> spice_display_change_preferred_compression(SpiceChannel *channel,
> gint comp
>   * spice_display_get_gl_scanout:
>   * @channel: a #SpiceDisplayChannel
>   *
> - * Returns: the current GL scanout
> + * Returns: the current GL scanout, or %NULL if none or not valid
>   *
>   * Since: 0.31
>   **/
> @@ -541,7 +541,7 @@ spice_display_get_gl_scanout(SpiceDisplayChannel
> *channel)
>  {
>      g_return_val_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel), NULL);
>  
> -    return &channel->priv->scanout;
> +    return channel->priv->scanout.fd != -1 ? &channel->priv->scanout 
> : NULL;
>  }
>  
>  /* ---------------------------------------------------------------
> --- */


More information about the Spice-devel mailing list