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

Marc-André Lureau marcandre.lureau at gmail.com
Tue Mar 22 12:57:11 UTC 2016


If there is no valid scanout, return NULL.

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;
 }
 
 /* ------------------------------------------------------------------ */
-- 
2.5.0



More information about the Spice-devel mailing list