summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2016-03-21 19:03:43 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2016-03-24 16:55:58 +0100
commit81767eb4767675ee0f03888ed4d34660bb4089ba (patch)
tree2221e210d2e992e318aa28317b3841c6c91f2f9b
parent804b50fa44023dba544094ec285b21176e69c32a (diff)
display: return NULL in spice_display_get_gl_scanout()
If there is no valid scanout, return NULL. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
-rw-r--r--src/channel-display.c4
-rw-r--r--src/spice-widget.c1
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)) {