[PATCH v3 4/9] display: return NULL in spice_display_get_gl_scanout()

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

 



If there is no valid scanout, return NULL.

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx>
---
 src/channel-display.c | 4 ++--
 src/spice-widget.c    | 1 +
 2 files changed, 3 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;
 }
 
 /* ------------------------------------------------------------------ */
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 03c7cd8..a820ed2 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2506,6 +2506,7 @@ static void gl_scanout(SpiceDisplay *display)
     g_return_if_fail(d->egl.context_ready);
 
     scanout = spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display));
+    /* should only be called when the display has a scanout */
     g_return_if_fail(scanout != NULL);
 
     if (!spice_egl_update_scanout(display, scanout, &err)) {
-- 
2.5.5

_______________________________________________
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]