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

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

 



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@xxxxxxxxx>
> ---
>  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;
>  }
>  
>  /* ---------------------------------------------------------------
> --- */
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]